CKII
CKII

Reputation: 1486

MissingTemplateException in UWP compiled for Release

I'm having a very odd problem.

We wrote a Windows Phone 8.1 app, and upgraded it to UWP. The debug version of the app works great, however, when I run it in release, I get this error:

Internal.Runtime.TypeLoader.TypeBuilder+MissingTemplateException: Exception of type '{0}' was thrown., Internal.Runtime.TypeLoader.TypeBuilder+MissingTemplateException. For more information, visit http://go.microsoft.com/fwlink/?LinkId=623485

When trying to open a specific ViewModel (working with MvvmCross). It happens only to this ViewModel, though it doesn't seem special in any way.

Note that I'm compiling it with .NetNative enabled. If I disable it, it works fine, but I can't release the app to the store without it.

Any help would be greatly appreciated.

Upvotes: 2

Views: 184

Answers (2)

CKII
CKII

Reputation: 1486

It appears the problem was that the offending ViewModel had an Init method that returned a Task:

public async Task Init(...)

Fixed by changing it to void:

public async void Init(...)

Not quite sure why, but it works...

Upvotes: 0

MattWhilden
MattWhilden

Reputation: 1696

That's one of the runtime exceptions in .NET Native. Most likely you can work around this by adding something to your Default.rd.xml file.

To properly diagnose this I'd recommend enabling .NET Native compilation for the DEBUG configuration of your project (Project properties > BUILD > Enable .Net Native checkbox). Then, set your debugger to stop on first chance exceptions. If you can move to Update 1, the messages are a bit better.

After digging in a bit, I'd love to know what it ends up being. It's pretty uncommon to hit this type of error so it would be great to know places where we can be better. You're always welcome to send specific feedback to us at [email protected].

Upvotes: 1

Related Questions