AsyncEx icon indicating copy to clipboard operation
AsyncEx copied to clipboard

Could not find assembly 'System.Threading.ThreadPool, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' referenced by 'Nito.AsyncEx.Interop.WaitHandles'.

Open LokiMidgard opened this issue 4 years ago • 5 comments

I have an UWP App when I try to build it for ARM in Release configuration it can't find the System.Threading.ThreadPool assembly. Also the build takes forever before showing the output. (Over an hour, but not sure if this is actually part of the problem)

The project where this happens is https://github.com/LokiMidgard/WP10-Music-Player Actual Commit

I assume it'll work in x64. But I just started the build and if it takes as long as ARM I will comment on this thread when I'll be back from work.

Target Version is 1809 (Build 17763) Min Version is Creators Update (Build 15063) Library Version Nito.AsyncEx (5.0.0)

I think the only class I need is AsyncManualResetEvent

Stack Trace (Interresting part I think)

2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): warning : ILTransform : warning ILT0010: Could not find assembly 'System.Threading.ThreadPool, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' referenced by 'Nito.AsyncEx.Interop.WaitHandles'. 2>C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\Microsoft.EntityFrameworkCore.Properties.Microsoft.EntityFrameworkCore.rd.xml(7): warning : ILTransform : warning ILT0027: Assembly name 'System.Collections.NonGeneric' failed to bind. 2> Computing application closure and generating interop code 2> Loading 135 modules... 2> Generating code... 2> Interop code generated. 2> Generating serialization code 2> Compiling interop code 2> Generating System.Reflection.DispatchProxy proxy code. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): warning : ILTransform : warning ILT0005: Type 'System.Threading.RegisteredWaitHandle' was not included in compilation, but was referenced in type 'Nito.AsyncEx.Interop.WaitHandleAsyncFactory+ThreadPoolRegistration'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): warning : ILTransform : warning ILT0005: Type 'System.Threading.WaitOrTimerCallback' was not included in compilation, but was referenced in type 'Nito.AsyncEx.Interop.WaitHandleAsyncFactory+ThreadPoolRegistration+<>c'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): warning : ILTransform : warning ILT0003: Method 'WaitHandleAsyncFactory.ThreadPoolRegistration..ctor(WaitHandle, TimeSpan, TaskCompletionSource)' will always throw an exception due to the missing method 'WaitOrTimerCallback..ctor(object, IntPtr)'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): warning : ILTransform : warning ILT0003: Method 'WaitHandleAsyncFactory.ThreadPoolRegistration.System.IDisposable.Dispose()' will always throw an exception due to the missing method 'RegisteredWaitHandle.Unregister(WaitHandle)'. There may have been a missing assembly. 2> Cleaning up unreferenced code 2> Generating native code 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : Internal Compiler Error 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : Type 'System.Threading.RegisteredWaitHandle' was not included in compilation, but was referenced in type 'Nito.AsyncEx.Interop.WaitHandleAsyncFactory+ThreadPoolRegistration'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : Type 'System.Threading.WaitOrTimerCallback' was not included in compilation, but was referenced in type 'Nito.AsyncEx.Interop.WaitHandleAsyncFactory+ThreadPoolRegistration+<>c'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : Method 'WaitHandleAsyncFactory.ThreadPoolRegistration..ctor(WaitHandle, TimeSpan, TaskCompletionSource)' will always throw an exception due to the missing method 'WaitOrTimerCallback..ctor(object, IntPtr)'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : Method 'WaitHandleAsyncFactory.ThreadPoolRegistration.System.IDisposable.Dispose()' will always throw an exception due to the missing method 'RegisteredWaitHandle.Unregister(WaitHandle)'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : Type 'System.Threading.RegisteredWaitHandle' was not included in compilation, but was referenced in type 'Nito.AsyncEx.Interop.WaitHandleAsyncFactory+ThreadPoolRegistration'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : Type 'System.Threading.WaitOrTimerCallback' was not included in compilation, but was referenced in type 'Nito.AsyncEx.Interop.WaitHandleAsyncFactory+ThreadPoolRegistration+<>c'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : Method 'WaitHandleAsyncFactory.ThreadPoolRegistration..ctor(WaitHandle, TimeSpan, TaskCompletionSource)' will always throw an exception due to the missing method 'WaitOrTimerCallback..ctor(object, IntPtr)'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : Method 'WaitHandleAsyncFactory.ThreadPoolRegistration.System.IDisposable.Dispose()' will always throw an exception due to the missing method 'RegisteredWaitHandle.Unregister(WaitHandle)'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : ILT0005: 'C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\ARM\ilc\Tools\nutc_driver.exe @"C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\obj\ARM\Release\ilc\intermediate\MDIL\MusicPlayer.rsp"' returned exit code 1

Complete StackTrace

2>------ Build started: Project: MusicPlayer, Configuration: Release ARM ------ 2>C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\Controls\Albums.xaml.cs(3,7,3,13): warning CS0105: The using directive for 'System' appeared previously in this namespace 2>C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\Controls\Albums.xaml.cs(5,7,5,33): warning CS0105: The using directive for 'System.Collections.Generic' appeared previously in this namespace 2>C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\Controls\Albums.xaml.cs(71,28,71,41): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. 2>C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\Controls\TiledBackgroundPanel.cs(211,18,211,29): warning CS8321: The local function 'ResizeArray' is declared but never used 2>C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\Pages\SettingsPage.xaml.cs(44,26,44,30): warning CS0219: The variable 'path' is assigned but its value is never used 2>C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\App.xaml.cs(57,39,57,49): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. 2>C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\Viewmodels\MediaplayerViewmodel.cs(104,17,104,36): warning CS4014: Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call. 2>C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\Viewmodels\MediaplayerViewmodel.cs(134,28,134,40): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. 2>C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\OldMainPage.xaml.cs(53,27,53,48): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. 2>C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\NowPlaying.xaml.cs(29,13,29,29): warning CS4014: Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call. 2>C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\NowPlaying.xaml.cs(32,51,32,60): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. 2>C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\Viewmodels\AlbumViewmodel.cs(81,35,81,44): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. 2>C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\OneDriveLibrary.cs(342,46,342,47): warning CS0168: The variable 'e' is declared but never used 2>C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\Controls\DisabledCommand.cs(15,35,15,52): warning CS0067: The event 'DisabledCommand.CanExecuteChanged' is never used 2>C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\Viewmodels\AlbumViewmodel.cs(236,44,236,49): warning CS0649: Field 'AlbumViewmodel.cover' is never assigned to, and will always have its default value null 2>C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\Controls\DelegateCommand.cs(17,35,17,52): warning CS0067: The event 'DelegateCommand.CanExecuteChanged' is never used 2> MusicPlayer -> C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\bin\ARM\Release\MusicPlayer.exe 2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(3126,5): warning : APPX4001: Build property AppxBundlePlatforms is not explicitly set and is calculated based on currently building architecture. Use 'Create App Package' wizard or edit project file to set it. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): warning : ILTransform : warning ILT0010: Could not find assembly 'System.Threading.ThreadPool, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' referenced by 'Nito.AsyncEx.Interop.WaitHandles'. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): warning : ILTransform : warning ILT0010: Could not find assembly 'System.Threading.ThreadPool, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' referenced by 'Nito.AsyncEx.Interop.WaitHandles'. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): warning : ILTransform : warning ILT0010: Could not find assembly 'System.Threading.ThreadPool, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' referenced by 'Nito.AsyncEx.Interop.WaitHandles'. 2> Processing application code 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): warning : ILTransform : warning ILT0010: Could not find assembly 'System.Threading.ThreadPool, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' referenced by 'Nito.AsyncEx.Interop.WaitHandles'. 2>C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\Microsoft.EntityFrameworkCore.Properties.Microsoft.EntityFrameworkCore.rd.xml(7): warning : ILTransform : warning ILT0027: Assembly name 'System.Collections.NonGeneric' failed to bind. 2> Computing application closure and generating interop code 2> Loading 135 modules... 2> Generating code... 2> Interop code generated. 2> Generating serialization code 2> Compiling interop code 2> Generating System.Reflection.DispatchProxy proxy code. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): warning : ILTransform : warning ILT0005: Type 'System.Threading.RegisteredWaitHandle' was not included in compilation, but was referenced in type 'Nito.AsyncEx.Interop.WaitHandleAsyncFactory+ThreadPoolRegistration'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): warning : ILTransform : warning ILT0005: Type 'System.Threading.WaitOrTimerCallback' was not included in compilation, but was referenced in type 'Nito.AsyncEx.Interop.WaitHandleAsyncFactory+ThreadPoolRegistration+<>c'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): warning : ILTransform : warning ILT0003: Method 'WaitHandleAsyncFactory.ThreadPoolRegistration..ctor(WaitHandle, TimeSpan, TaskCompletionSource)' will always throw an exception due to the missing method 'WaitOrTimerCallback..ctor(object, IntPtr)'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): warning : ILTransform : warning ILT0003: Method 'WaitHandleAsyncFactory.ThreadPoolRegistration.System.IDisposable.Dispose()' will always throw an exception due to the missing method 'RegisteredWaitHandle.Unregister(WaitHandle)'. There may have been a missing assembly. 2> Cleaning up unreferenced code 2> Generating native code 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : Internal Compiler Error 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : Type 'System.Threading.RegisteredWaitHandle' was not included in compilation, but was referenced in type 'Nito.AsyncEx.Interop.WaitHandleAsyncFactory+ThreadPoolRegistration'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : Type 'System.Threading.WaitOrTimerCallback' was not included in compilation, but was referenced in type 'Nito.AsyncEx.Interop.WaitHandleAsyncFactory+ThreadPoolRegistration+<>c'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : Method 'WaitHandleAsyncFactory.ThreadPoolRegistration..ctor(WaitHandle, TimeSpan, TaskCompletionSource)' will always throw an exception due to the missing method 'WaitOrTimerCallback..ctor(object, IntPtr)'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : Method 'WaitHandleAsyncFactory.ThreadPoolRegistration.System.IDisposable.Dispose()' will always throw an exception due to the missing method 'RegisteredWaitHandle.Unregister(WaitHandle)'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : Type 'System.Threading.RegisteredWaitHandle' was not included in compilation, but was referenced in type 'Nito.AsyncEx.Interop.WaitHandleAsyncFactory+ThreadPoolRegistration'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : Type 'System.Threading.WaitOrTimerCallback' was not included in compilation, but was referenced in type 'Nito.AsyncEx.Interop.WaitHandleAsyncFactory+ThreadPoolRegistration+<>c'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : Method 'WaitHandleAsyncFactory.ThreadPoolRegistration..ctor(WaitHandle, TimeSpan, TaskCompletionSource)' will always throw an exception due to the missing method 'WaitOrTimerCallback..ctor(object, IntPtr)'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : Method 'WaitHandleAsyncFactory.ThreadPoolRegistration.System.IDisposable.Dispose()' will always throw an exception due to the missing method 'RegisteredWaitHandle.Unregister(WaitHandle)'. There may have been a missing assembly. 2>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Microsoft.NetNative.targets(697,5): error : ILT0005: 'C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\ARM\ilc\Tools\nutc_driver.exe @"C:\Users\patri\source\repos\MusicPlayer\MusicPlayer\obj\ARM\Release\ilc\intermediate\MDIL\MusicPlayer.rsp"' returned exit code 1 ========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

LokiMidgard avatar Jul 04 '19 04:07 LokiMidgard

Update, no it does not work under x64 :(

LokiMidgard avatar Jul 04 '19 14:07 LokiMidgard

ThreadPool is unavailable in UWP with target lower than Fall Creators Update (16267 version, if i am right). https://apisof.net/catalog/System.Threading.ThreadPool

Looks like it causes your problem.

maxkatz6 avatar Jul 05 '19 11:07 maxkatz6

@StephenCleary I think, WaitHandles project should target netstandard1.6;netstandard2.0 instead of netstandard1.3;netstandard2.0. Or do not depend from ThreadPool, if it is possible.

maxkatz6 avatar Jul 05 '19 11:07 maxkatz6

ThreadPool is unavailable in UWP with target lower than Fall Creators Update

Well, that's unfortunate. UWP claims to support ThreadPool even in the original 10.0.

Changing WaitHandles to netstandard1.6 seems like a viable option. Removing the dependency isn't possible; WaitHandles pretty much only uses ThreadPool.

StephenCleary avatar Jul 05 '19 18:07 StephenCleary

Note to self: it may be better to use UWP-specific versioned dependencies so that UWP pre-16267 will not attempt to pull in WaitHandles at all.

StephenCleary avatar Jul 05 '19 18:07 StephenCleary