Xamarin.forms: [Bug] UWP is throwing exception randomly after 4.8.0.1687 and VS 2019 16.8.1

Created on 18 Nov 2020  路  11Comments  路  Source: xamarin/Xamarin.Forms

Description

After updating VS 2019 16.8.1 version. I am keep getting exception on the function shown below screenshot. This is happening in different places but mostly when i try to navigate between pages. GetXamlTypeByName(string typeName)
typeName is also different on the crash. I read somewhere that it is related to Uwp Hot reload added into this version and it was suggested that disable hot reload toolbar on top which i did but it didnt help. Still happening.

only message in the debug window is as below. I a worried that this is not VS related but with 4.8.0.1687 version.

Exception thrown: 'System.IO.FileNotFoundException' in System.Private.CoreLib.dll
An unhandled exception of type 'System.ExecutionEngineException' occurred in System.Private.CoreLib.dll

image

VS bug #1248154

external-hotreload UWP bug

Most helpful comment

Build error with VS 16.8.2, disabling EnableTypeInfoReflection and UWP in-app toolbar:

\obj\x86\Debug\XamlTypeInfo.g.cs(117,43,117,49): error CS0234: The type or namespace name 'Markup' does not exist in the namespace 'Microsoft.UI.Xaml' (are you missing an assembly reference?)

It works now with disabled EnableTypeInfoReflection, maybe some cache before. Restart VS and clean solution after change it.

All 11 comments

@maxbrister does this ring a bell ??

Same random error on UWP after VS 16.8.1 update

Yes, this is a known issue with Uwp/Xamarin incremental hot reload.

Disabling the Uwp in-app toolbar should workaround the crash (uncheck Options->Debugging->Hot Reload ->Enable in-app toolbar). Unfortunately the underlying crash is caused by a core clr issue and apps making heavy use of reflection may experience issues. We are working on a fix for 16.9.

I have that disabled on 16.8.1 and 16.9 pre. it fixes the issue on 16.9 pre but disabling doesnt help on 16.8.1 stable

image

Can you try adding the following to your Uwp project head?

<PropertyGroup>
  <EnableTypeInfoReflection>false</EnableTypeInfoReflection>
</PropertyGroup>

@EmilAlipiev Could you try the latest suggestion from Max?

Build error with VS 16.8.2, disabling EnableTypeInfoReflection and UWP in-app toolbar:
\obj\x86\Debug\XamlTypeInfo.g.cs(117,43,117,49): error CS0234: The type or namespace name 'Markup' does not exist in the namespace 'Microsoft.UI.Xaml' (are you missing an assembly reference?)

Build error with VS 16.8.2, disabling EnableTypeInfoReflection and UWP in-app toolbar:

\obj\x86\Debug\XamlTypeInfo.g.cs(117,43,117,49): error CS0234: The type or namespace name 'Markup' does not exist in the namespace 'Microsoft.UI.Xaml' (are you missing an assembly reference?)

It works now with disabled EnableTypeInfoReflection, maybe some cache before. Restart VS and clean solution after change it.

I disabled all of the UWP hot reload debug options and was still getting the ExecutionEngineException randomly. I then added <EnableTypeInfoReflection>false</EnableTypeInfoReflection> to my UWP csproj and haven't had any exceptions.

question is if that is effecting Release mode as well?? or it is just debug issue. Do i need this EnableTypeInfoReflection = false when i want to make a new release?

That's a good question. I'm also concerned with adding a new csproj tag not fully understanding the side effects.

Was this page helpful?
0 / 5 - 0 ratings