We have a Windows 10 UWP application that works great when building Debug and crashes in Release versions. We are talking about releases that lead to a failure in the fact that the .NET Native tool chain is turned on - a shutdown that allows you to run the application. But this is not a real fix because it should be launched using the .NET Native toolchain if you are going to publish to the repository.
We use Microsoft.Practices.Unity for DI. Here is an example of how we register some classes:
container.RegisterType<IBoardView, BoardView>();
And then in our application we will resolve it as follows:
container.Resolve<IBoardView>();
It works fine if I don't run it with .NET Native, in which case I get the following exception:
An exception of type "Microsoft.Practices.Unity.ResolutionFailedException" occurred in Microsoft.Practices.Unity.dll, but was not processed in the user code
Additional information: Dependency resolution error, type = "WindowsUniversal.ViewModels.Interfaces.IBoardViewModel", name = "(none)".
An exception occurred when: at resolution.
And in the output window, I get:
An exception is thrown: 'System.NullReferenceException' in System.Linq.Expressions.dll
Exception: "System.NullReferenceException" in Microsoft.Practices.Unity.dll
Exception thrown: "Microsoft.Practices.Unity.ResolutionFailedException" in Microsoft.Practices.Unity.dll
An exception of type "Microsoft.Practices.Unity.ResolutionFailedException" occurred in Microsoft.Practices.Unity.dll, but was not processed in the user code
Additional information: Dependency resolution error, type = "WindowsUniversal.ViewModels.Interfaces.IBoardViewModel", name = "(none)".
An exception occurred when: at resolution.
Exception: NullReferenceException - the reference to the object is not installed in the instance of the object.
At the time of the exception, the container was:
WindowsUniversal.ViewModels.Interfaces.IBoardViewModel, (none)
, .NET Native . , .NET Native , . , , ?
, .