dadhi / DryIoc

DryIoc is fast, small, full-featured IoC Container for .NET
MIT License
988 stars 122 forks source link

Build fails for UWP with native tool chain enabled (DryIoc 5.0.1) #527

Closed andreisbarnea closed 1 year ago

andreisbarnea commented 1 year ago

Build and app works in debug and release, without the native tool chain option enabled but for publishing on windows store it is required to have native tool chain enabled and with it the build fails.

UWP project

target version: Windows 10, version 1903 (build 18362) min version: Windows 10,version 1809 (build 17763)

Relevant referenced libraries:

DryIoc.dll 5.0.1 DryIoc.Microsoft.DependencyInjection 6.0.0 DryIoc.Microsoft.DependencyInjection.Extension 1.0.0.2 Microsoft.Extensions.DependencyInjection 6.0.0 Microsoft.Extensions.DependencyInjection.Abstractions 6.0.0

The relevant build logs (first a warning then the errors):

Processing application code Computing application closure and generating interop code Loading 239 modules... Generating code... Interop code generated. Generating serialization code Compiling interop code Generating System.Reflection.DispatchProxy proxy code. C:\Users\andrei.nuget\packages\microsoft.net.native.compiler\2.2.10-rel-29722-00\tools\Microsoft.NetNative.targets(805,5): warning : ILTransform : warning ILT0003: Method 'ServiceCollectionExtensions.RegisterDescriptor(IContainer, ServiceDescriptor)' will always throw an exception due to the missing method 'Registrator.RegisterDelegate(IRegistrator, bool, Type, Func<IResolverContext, object>, IReuse, Setup, Nullable, object)' in assembly 'DryIoc'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.

Cleaning up unreferenced code Generating native code

C:\Users\andrei.nuget\packages\microsoft.net.native.compiler\2.2.10-rel-29722-00\tools\Microsoft.NetNative.targets(805,5): error : Method 'ServiceCollectionExtensions.RegisterDescriptor(IContainer, ServiceDescriptor)' will always throw an exception due to the missing method 'Registrator.RegisterDelegate(IRegistrator, bool, Type, Func<IResolverContext, object>, IReuse, Setup, Nullable, object)' in assembly 'DryIoc'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.

C:\Users\andrei.nuget\packages\microsoft.net.native.compiler\2.2.10-rel-29722-00\tools\Microsoft.NetNative.targets(805,5): error : Method 'ServiceCollectionExtensions.RegisterDescriptor(IContainer, ServiceDescriptor)' will always throw an exception due to the missing method 'Registrator.RegisterDelegate(IRegistrator, bool, Type, Func<IResolverContext, object>, IReuse, Setup, Nullable, object)' in assembly 'DryIoc'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.

C:\Users\andrei.nuget\packages\microsoft.net.native.compiler\2.2.10-rel-29722-00\tools\Microsoft.NetNative.targets(805,5): error : ILT0005: 'C:\Users\andrei.nuget\packages\runtime.win10-x86.microsoft.net.native.compiler\2.2.10-rel-29722-00\tools\x86\ilc\Tools\nutc_driver.exe @"F:\Repos2021\test\dtv.op\dtv.op.UWP\obj\x86\Release_44305\ilc\intermediate\MDIL\dtv.op.UWP.rsp"' returned exit code 1

Build has been canceled.

dadhi commented 1 year ago

@andreisbarnea Hmm, what is that "DryIoc.Microsoft.DependencyInjection.Extension 1.0.0.2"?

Otherwise, I will check the versions but I don't remember deleting the RegisterDelegate method.

andreisbarnea commented 1 year ago

@andreisbarnea Hmm, what is that "DryIoc.Microsoft.DependencyInjection.Extension 1.0.0.2"?

Otherwise, I will check the versions but I don't remember deleting the RegisterDelegate method.

DryIoc.Microsoft.DependencyInjection.Extension 1.0.0.2 points to: https://github.com/juner/Prism.Extensions.ServiceCollection which I frankly don't remember adding since we don't even use Prism. I removed it and it proved to be the culprit. Thank you.

dadhi commented 1 year ago

@andreisbarnea 🥂