0
votes

In my application, running on a LG G3 D855, I get this error on when starting up, it happens usually when my application has not been started in a while, always restarting it after it crashes works fine:

E/linker  ( 2105): readlink('/proc/self/fd/28') failed: Permission denied [fd=28]
E/linker  ( 2105): warning: unable to get realpath for the library "/vendor/lib/egl/eglsubAndroid.so". Will use given name.
E/mono    ( 2105): 
E/mono    ( 2105): Unhandled Exception:
E/mono    ( 2105): System.NullReferenceException: Object reference not set to an instance of an object
E/mono    ( 2105):   at Dictionary.Fragments.SearchFragment+<>c__DisplayClass13_0.<PerformSearch>b__0 (System.Object x) [0x00050] in <88db5ed5788f4131a4894bb5620511e9>:0 
E/mono    ( 2105):   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x0000e] in <8552b98493c447d5a7a1f07bdaff39bb>:0 
E/mono    ( 2105):   at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x0008d] in <8552b98493c447d5a7a1f07bdaff39bb>:0 
E/mono    ( 2105):   at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <8552b98493c447d5a7a1f07bdaff39bb>:0 
E/mono    ( 2105):   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x0002a] in <8552b98493c447d5a7a1f07bdaff39bb>:0 
E/mono    ( 2105):   at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00096] in <8552b98493c447d5a7a1f07bdaff39bb>:0 
E/mono    ( 2105):   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <8552b98493c447d5a7a1f07bdaff39bb>:0

This is the code it fails on:

private void PerformSearch(string input) {
  ThreadPool.QueueUserWorkItem( x => {
    if ( _tranService == null )
      _tranService = new TranslationService();

    var translations = _tranService.Translate( input );
    _transAdapter.Update( translations );
    Activity.RunOnUiThread( () => _transAdapter.NotifyDataSetChanged() );
  } );
}

Please let me know what this is, its annoying me very much. Its also happening in another app I am making which uses the same kind of ThreadPool.QueueUserWorkItem() block.

My installation:

Microsoft Visual Studio Professional 2015 Version 14.0.25431.01 Update 3 Microsoft .NET Framework Version 4.6.01586

Installed Version: Professional

Microsoft Visual Studio Tools for Applications 2015
00322-40000-00000-AA309 Microsoft Visual Studio Tools for Applications 2015

Visual Basic 2015 00322-40000-00000-AA309 Microsoft Visual Basic 2015

Visual C# 2015 00322-40000-00000-AA309 Microsoft Visual C# 2015

Visual C++ 2015 00322-40000-00000-AA309 Microsoft Visual C++ 2015

Application Insights Tools for Visual Studio Package 7.17.00119.9 Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1 14.1.21111.0 ASP.NET and Web Tools 2015.1

ASP.NET Web Frameworks and Tools 2012.2 4.1.41102.0 For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013 5.2.40314.0 For additional information, visit http://www.asp.net/

Azure App Service Tools v2.8.1 14.0.11123.0 Azure App Service Tools v2.8.1

Command Bus, Event Stream and Async Manager Merq Provides ICommandBus, IEventStream and IAsyncManager MEF services for loosely coupled Visual Studio extension components communication and integration.

Common Azure Tools 1.8 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Indent Guides 15 Indent Guides

Adds visual guides at each indentation level.

JavaScript Language Service 2.0 JavaScript Language Service

JavaScript Project System 2.0 JavaScript Project System

JetBrains ReSharper Ultimate 2016.2.2 Build 106.0.20160913.91321 JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2017 JetBrains, Inc.

Microsoft .NET Core Tools (Preview 2) 14.1.21111.0 Microsoft .NET Core Tools (Preview 2)

Microsoft Azure Mobile Services Tools 1.4 Microsoft Azure Mobile Services Tools

NuGet Package Manager 3.5.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer 1.2 Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Analysis Services 13.0.1605.88 Microsoft SQL Server Analysis Services Designer Version 13.0.1605.88

SQL Server Data Tools 14.0.60629.0 Microsoft SQL Server Data Tools

SQL Server Integration Services Microsoft SQL Server Integration Services Designer Version 13.0.1601.5

SQL Server Reporting Services 13.0.1605.88 Microsoft SQL Server Reporting Services Designers Version 13.0.1605.88

TypeScript 1.8.36.0 TypeScript tools for Visual Studio

Visual Studio Tools for Unity 2.8.0.0 Visual Studio Tools for Unity

Windows Installer XML Toolset 3.10.2.2516 Windows Installer XML Toolset version 3.10.2.2516 Copyright (c) Outercurve Foundation. All rights reserved.

Xamarin 4.2.2.11 (00fa5cc) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android 7.0.2.42 (501e63c) Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS 10.3.1.8 (7beaef4) Visual Studio extension to enable development for Xamarin.iOS.

1
Can you step through the code in that method to try to see what object is null? My first thought would be _transAdapter as you are not doing a null check on it. Perhaps somehow _transAdapter is being disposed and is not recreated when resuming the app? - jgoldberger - MSFT
@jgoldberger problem is, it happens on the actual device on startup, intermittently, I cannot debug it. - sprocket12
Perhaps try doing a null check on _transAdapter just to see if that might be the issue: _transAdapter?.Update( translations ); or if (_transAdapter != null) _transAdapter.Update( translations ); - jgoldberger - MSFT

1 Answers

0
votes

This was fixed in both my apps by not using ThreadPool.QueueUserWorkItem and instead using TPL, Task.Factory.StartNew() to do the same thing. I did not find out why the ThreadPool.QueueUserWorkItem failed, and Xamarin did not log a response to my bug report.