question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Critical] GetXamlTypeByName(string typeName) fails for typename Windows.UI.Xaml.Controls.RevealBackgroundBrush

See original GitHub issue

Describe the bug image

TypeName: “Windows.UI.Xaml.Controls.RevealBackgroundBrush”

Demo project is in here: App1.zip

Steps to reproduce the bug

Steps to reproduce the behavior:

  1. Install Microsoft.UI.Xaml 2.5.0
  2. Override OnWindowCreated(WindowCreatedEventArgs args) in App.cs
  3. Set a break point on it image
  4. Set break on FileNotFoundException image
  5. Make sure you use any Controls from Microsoft.UI.Xaml image
  6. Run demo app in X64 Debug mode
  7. Wait until VS hit the break point on “OnWindowCreated” image
  8. Wait for a few seconds
  9. Press F5 to continue
  10. Got the exception.
 	System.Private.CoreLib.dll!System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(System.Reflection.AssemblyName assemblyName)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(System.IntPtr gchManagedAssemblyLoadContext, System.Reflection.AssemblyName assemblyName)	Unknown
 	[Native to managed conversion]	
 	[Managed to native  conversion]	
 	System.Private.CoreLib.dll!System.RuntimeTypeHandle.GetTypeByName(string name, bool throwOnError, bool ignoreCase, bool reflectionOnly, ref System.Threading.StackCrawlMark stackMark, System.IntPtr pPrivHostBinder, bool loadTypeFromPartialName)	Unknown
 	System.Private.CoreLib.dll!System.RuntimeType.GetType(string typeName, bool throwOnError, bool ignoreCase, bool reflectionOnly, ref System.Threading.StackCrawlMark stackMark)	Unknown
 	System.Private.CoreLib.dll!System.Type.GetType(string typeName)	Unknown
 	Microsoft.UI.Xaml.Markup.winmd!Microsoft.UI.Xaml.Markup.ReflectionXamlMetadataProvider.GetNonGenericType(string compilerTypeName = "Windows.UI.Xaml.Controls.RevealBackgroundBrush")	Unknown
 	Microsoft.UI.Xaml.Markup.winmd!Microsoft.UI.Xaml.Markup.ReflectionXamlMetadataProvider.CreateXamlType(string typeName)	Unknown
 	Microsoft.UI.Xaml.Markup.winmd!Microsoft.UI.Xaml.Markup.ReflectionXamlMetadataProvider.getXamlType(string typeName)	Unknown
>	App1.exe!App1.App1_XamlTypeInfo.XamlTypeInfoProvider.GetXamlTypeByName(string typeName = "Windows.UI.Xaml.Controls.RevealBackgroundBrush") Line 136	C#
 	App1.exe!App1.App1_XamlTypeInfo.XamlMetaDataProvider.GetXamlType(string fullName = "Windows.UI.Xaml.Controls.RevealBackgroundBrush") Line 100	C#
 	App1.exe!App1.App.GetXamlType(string fullName = "Windows.UI.Xaml.Controls.RevealBackgroundBrush") Line 49	C#

Expected behavior

Should not throw any exception. It might throw a lot of FileNotFoundException which cause my app stop responding for about 20 seconds on startup

Version Info

NuGet package version: [Microsoft.UI.Xaml 2.5.0] [Microsoft.UI.Xaml 2.6.0-latestprelease]

Windows app type:

UWP Win32
Yes
Windows 10 version Saw the problem?
Insider Build (xxxxx)
October 2020 Update (19042) Yes
May 2020 Update (19041)
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT

Additional context If we don’t set any break point on OnWindowCreated or any other function, or do not use any Controls from Microsoft.UI.Xaml. This issue will not be triggered.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
zhuxb711commented, May 15, 2021

I think it might the same issue as https://github.com/microsoft/microsoft-ui-xaml/issues/2042

After set this to .proj file, issue gone.

<EnableTypeInfoReflection>false</EnableTypeInfoReflection>
0reactions
zhuxb711commented, May 17, 2021

I could not repro this in another computer. Might be related to environment

Read more comments on GitHub >

github_iconTop Results From Across the Web

GetXamlTypeByName(string typeName) fails for ...
GetXamlTypeByName (string typeName) fails for typename Windows.UI.Xaml.Controls.RevealBackgroundBrushClosed - Other Product View resolution
Read more >
Provider.GetXamlType on ARM64 · Issue #2042
[Critical] GetXamlTypeByName(string typeName) fails for typename Windows.UI.Xaml.Controls.RevealBackgroundBrush #5011.
Read more >
global::Windows.UI.Xaml.Markup.IXamlType ...
IXamlType GetXamlTypeByName is called with the typeName = "Microsoft. ... throws exception when trying to load Microsoft.UI.Xaml.Controls.
Read more >
[UWP] Could not find or load a specific file. (Exception from ...
My UWP app is throwing exception and crashing on start up giving the following error in the file XamlTypeInfo.g.cs System.IO.
Read more >
Untitled
Create new Uwp project ( UI-Project) Add false in to the project file. ... the bug TypeName: "Windows.UI.Xaml.Controls.RevealBackgroundBrush" Demo project ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found