Search code examples
.netwindows-runtimewindows-store-appsuwp.net-native

Extremely bad performance in .Net Native compiled UWP app


I encounter very bad performance when I compile my UWP app with the .Net Native Toolchain enabled.

I profiled the running code (native) and it seems that methods relying on reflection (Unity IoC, Behaviors-SDK, Linq, sqlite-net) are the culprit.

I use the Default.rd.xml so far.

<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
   <Application>
     <Assembly Name="*Application*" Dynamic="Required All" />
   </Application>
</Directives>

I have no MissingMetaDataExceptions so far. These only start as I expected when I remove the Application line.

Is there something I'm not seeing here? The app has very good performance without .Net Native. Does it help If I write the Default.rd.xml from scratch working through all MissingMetaDataExceptions which will come?


Solution

  • The UWP Tools in version 1.3.1 did alleviate the performance impact of MvvmLight.

    It was still kind of slow so I switched my IoC-container from Unity to AutoFac. That helped a bit as well but was still not good enough. In the end I had to resort to creating my ViewModels via new again without using the Resolve of the IoC-Container. Now it's very snappy. I did remove all behaviors, this could have helped but I'm not sure about this without implementing them again.