So I have now finished coding for my Xamarin Application and all works fine in the Debug builds. I've then tested the Release build on Android by Archiving and Signing the APK, and it works fine, but the problem comes in when trying to Build the UWP Project Package Files. If I try to start the program then I get the following Exception:
+ $exception {Xamarin.Forms.Xaml.XamlParseException: No embeddedresource found for AppPrescribe.App
at Xamarin.Forms.Xaml.XamlLoader.Load(Object view, Type callingType)
at AppPrescribe.UWP.MainPage..ctor() in D:\Xamarin\P\AppPrescribe\AppPrescribe\AppPrescribe.UWP\MainPage.xaml.cs:line 26
at AppPrescribe.UWP.AppPrescribe_UWP_XamlTypeInfo.XamlTypeInfoProvider.Activate_4_MainPage() in D:\Xamarin\P\AppPrescribe\AppPrescribe\AppPrescribe.UWP\obj\x86\Release\XamlTypeInfo.g.cs:line 255
at Xamarin.Forms.Platform.UAP.Xamarin_Forms_Platform_UAP_XamlTypeInfo.XamlUserType.ActivateInstance()
at __Interop.ReverseComStubs.Stub_19(Object __this, Void** unsafe_returnValue__retval, IntPtr __methodPtr)} Xamarin.Forms.Xaml.XamlParseException
I'm also returned to my UWP Project, inside the MainPage.xaml.cs
file, and my cursor is placed next to LoadApplication(new AppPrescribe.App());
inside the MainPage
Constructor.
And if I try to go ahead with Creating the App Packages, the Application crashes multiple times during the Test phases. (Again, I changed no code between Debug and Release)
What am I missing here? Forgive me if it's a dumb solution.
I've tried:
but I still get the same error.
EDIT: If I uncheck "Compile with .NET Native tool chain" then the app compiles fine and runs in debug, but then I cannot create the App package because Windows App Certification fails the Binary Analyzer side of the testing. If I leave it checked (along with Optimize Code) and then debug, the Application goes into Break Mode and I get this Exception:
Unhandled exception at 0x101F43FA (Windows.UI.Xaml.dll) in DisChemPrescribe.UWP.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x0352CD90, 0x00000002).
That happens when you update PCL projects into .Net Standard. If you open a PCL's csproj file you'll see Xaml and Xaml.cs connections like
</Compile>
<Compile Include="OverviewPage.xaml.cs">
<DependentUpon>Overview.xaml</DependentUpon>
</Compile>
However, once you migrate your PCL to .Net Standard this connections dissapears.
There are 2 solution to fix this issue (afaik).
Add embedded resource definiton to csproj file
<EmbeddedResource Update="OverviewPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
Use Xaml Compilations: Add Xaml compilation tag for all xaml.cs files
[XamlCompilation(XamlCompilationOptions.Compile)]
User contributions licensed under CC BY-SA 3.0