I have developed an UWP app that works globally fine, but I encounter some problems with the Store app, or with the Release build, whereas all works fine in Debug build...
The app seems very basic: ts allows users to create and sync forms through webservices. At the launch of the app, a test is done to see if a user is already logged in: if it's not the case, the app navigates to the "Login" page, otherwise it navigates to the "Home" page, which contains the forms list. Then the user can edit each form through a "Details" page.
"Debug" mode:
When I build the app in "Debug" mode, I don't encounter any exception that isn't catched and all works fine.
The Store app:
The last version of the Store app has been successfully generated and validated without any problem. But one of my last changes raises a crash of the app, when the user coming back from the "Details" page to the "Home" page.
I suspect especially this change to raise the error: I've added some code on the "Details" view to clean the resources through "OnNavigatedFrom()":
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
ViewModel = this.DataContext as DetailsViewModel;
if (!ViewModel.ToChildNavigate)
{
// Dispose resources
this.Resources.Clear();
this.Loaded -= DetailsPage_Loaded;
ViewModel = null;
}
base.OnNavigatedFrom(e);
}
To fix this, I would like to build the app in "Release" mode with ".Net Native tool chain".
"Release" mode:
In "Release" mode, I have checked well the options "Compile with .NET Native tool chain" and "Optimize code".

The application launches correctly and navigates fine the "Login" page. But after the user's connection, the app tries to navigate to the "Home" page: I get 2 exceptions, and I can't do anything else...
The first exception occurs one time, and I can "continue":

The second exceptions occurs each time even if I try to continue:

I've tried to add some MessageDialog to see where the error occurs, but the message is not displayed in the consctructors: so I can't identify the origin of the problem...
"Debug" mode with "Native tool chain"
Finally, I've tried to build the app in "Debug" mode again, but with the options "Compile with .NET Native tool chain" and "Optimize code".
But like this, it works fine, and I can't reproduce the error encountered in "Release" mode...
I don't have another ideas, and I can't anwser to these questions:
- why are there differences between the Store version and the Release mode?
- how could I done to use the app in Release mode? is it possible to "debug" it?
- I have to launch the app in Release mode to fixe the encountered bug of the Store version...
Regards,