Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] DataGrid and System.Reflection.MissingMetadataException: 'Windows.Foundation.IReference`1<Double>' #4254

Open
omikhailov opened this issue Sep 16, 2021 · 13 comments
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior DataGrid 🔠 Issues on DataGrid control external ⤴️ Requires an update to an external dependency or due to code outside the Toolkit. help wanted Issues identified as good community contribution opportunities question ❔ Issues or PR require more information WinUI 💠 Related to WinUI 3 Version or when paired with External can mean requires fix in WinUI 2/3.

Comments

@omikhailov
Copy link

Hello!

I have the following problem: I changed hardware, installed the latest Windows updates and also updated the WCT and WinUI 2 packages, and now after starting the application in Release mode, it fails. In Debug mode with enabled Optimize Code and .Net Native Toolchain options, the following exception is thrown in GetXamlTypeByType() within XamlTypeInfo.g.cs :

System.Reflection.MissingMetadataException
  HResult=0x80131543
  Message=Windows.Foundation.IReference`1<Double>

Call Stack:
 	[External Code]	
 	System.Private.Interop.dll!System.Runtime.InteropServices.McgTypeHelpers.McgFakeMetadataType.GUID.get() Line 134	C#
 	System.Private.Reflection.Core.dll!System.Reflection.Runtime.TypeInfos.RuntimeTypeInfo.IsAssignableFrom(System.Type c) Line 274	C#
	System.Private.Reflection.Core.dll!System.Reflection.Runtime.TypeInfos.RuntimeTypeInfo.IsAssignableFrom(System.Reflection.TypeInfo typeInfo) Line 264	C#
 	Microsoft.UI.Xaml.Markup.dll!Microsoft.UI.Xaml.Markup.XamlReflectionType.XamlReflectionType(System.Type underlyingType)	Unknown
 	Microsoft.UI.Xaml.Markup.dll!Microsoft.UI.Xaml.Markup.ReflectionXamlMetadataProvider.getXamlType(System.Type typeID)	Unknown
	Common.ViewLayer.dll!Common.ViewLayer.Common_ViewLayer_XamlTypeInfo.XamlTypeInfoProvider.GetXamlTypeByType(System.Type type) Line 79	C#
 	Common.ViewLayer.dll!Common.ViewLayer.Common_ViewLayer_XamlTypeInfo.XamlMetaDataProvider.GetXamlType(System.Type type) Line 40	C#
 	Hamburger.exe!Hamburger.Hamburger_XamlTypeInfo.XamlTypeInfoProvider.CheckOtherMetadataProvidersForType(System.Type type) Line 1965	C#
 	Hamburger.exe!Hamburger.Hamburger_XamlTypeInfo.XamlTypeInfoProvider.GetXamlTypeByType(System.Type type) Line 133	C#
 	Hamburger.exe!Hamburger.App.GetXamlType(System.Type type) Line 39	C#
 	Hamburger.McgInterop.dll!Windows.UI.Xaml.Markup.IXamlMetadataProvider__Impl.Vtbl.GetXamlType__n(System.IntPtr pComThis, System.Type__Impl.UnsafeType unsafe_type, void** unsafe_result__retval)	C#
 	[External Code]	
 	System.Private.Interop.dll!System.Runtime.InteropServices.McgMarshal.ActivateInstance(string typeName) Line 1252	C#
 	Hamburger.McgInterop.dll!Microsoft.UI.Xaml.Controls.XamlControlsResources.XamlControlsResources()	C#
 	Hamburger.exe!Hamburger.Hamburger_XamlTypeInfo.XamlTypeInfoProvider.Activate_0_XamlControlsResources() Line 549	C#
 	Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.dll!Microsoft.Toolkit.Uwp.UI.Controls.Microsoft_Toolkit_Uwp_UI_Controls_DataGrid_XamlTypeInfo.XamlUserType.ActivateInstance() Line 2662	C#
 	Hamburger.McgInterop.dll!__Interop.ReverseComStubs.Stub_12(object __this, void** unsafe_result__retval, System.IntPtr __methodPtr)	C#
 	Hamburger.McgInterop.dll!Windows.UI.Xaml.Markup.IXamlType__Impl.Vtbl.ActivateInstance__n(System.IntPtr pComThis, void** unsafe_result__retval)	C#

Default.rd.xml has following entries:

<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
  <Application>
    <Assembly Name="*Application*" Dynamic="Required All" />
    
    <Type Name="Windows.Foundation.TypedEventHandler{Microsoft.UI.Xaml.Controls.NavigationView,Microsoft.UI.Xaml.Controls.NavigationViewItemInvokedEventArgs}" MarshalObject="Public" />

    <Type Name="Microsoft.UI.Xaml.Controls.NavigationView">
      <Event Name="ItemInvoked" Dynamic="Required"/>
    </Type>

    <Type Name="Windows.Foundation.TypedEventHandler{Microsoft.UI.Xaml.Controls.NavigationView,Microsoft.UI.Xaml.Controls.NavigationViewBackRequestedEventArgs}" MarshalObject="Public" />

    <Type Name="Microsoft.UI.Xaml.Controls.NavigationView">
      <Event Name="BackRequested" Dynamic="Required"/>
    </Type>

    <Type Name="Windows.UI.Xaml.Controls.Frame">
      <Method Name="GoBack" Dynamic="Required" />
    </Type>

    <Type Name="Microsoft.Toolkit.Uwp.UI.Controls.DataGridColumnEventArgs" Dynamic="Public" />

    <Type Name="Microsoft.Toolkit.Uwp.UI.Controls.DataGrid">
      <Event Name="Sorting" Dynamic="Required" />
      <Event Name="DoubleTapped" Dynamic="Required" />
      <Event Name="PreviewKeyDown" Dynamic="Required" />
      <Event Name="RightTapped" Dynamic="Required" />
      <Property Name="SelectedItem" Dynamic="Required" />
    </Type>
    
    <Type Name="Windows.UI.Xaml.Controls.Maps.MapControl">
      <Event Name="MapElementClick" Dynamic="Required" />
    </Type>

  </Application>
</Directives>

... and adding

<Type Name="Windows.Foundation.IReference`1{Double}" Dynamic="Required All" />

does not fix it.

Is it some known issue with the DataGrid?

Here is the link to .zip file with the app code in case if somebody would need to reproduce the issue: https://1drv.ms/u/s!AhdSWUTnA1aPgjz3Mp8UNmITf-zv?e=LEaD2m
I'm on Windows 10 Pro 19043.1237, Visual Studio 2019 16.11.3 and Ryzen 3600

@omikhailov omikhailov added the question ❔ Issues or PR require more information label Sep 16, 2021
@ghost ghost added the needs triage 🔍 label Sep 16, 2021
@ghost
Copy link

ghost commented Sep 16, 2021

Hello omikhailov, thank you for your interest in Windows Community Toolkit!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible.. Other community members may also answer the question and provide feedback 🙌

@michael-hawker
Copy link
Member

Hi @omikhailov the project looks a bit complex, can you point us to the project that should be run (you can also just attach zip files to issues directly usually)?

What specific versions of the Toolkit and WinUI are you using as there are various previews and stable releases available at the moment?

@omikhailov
Copy link
Author

Hi, Michael!

Startup project is called Hamburger, and all projects within solution use Windows Community Toolkit 7.0.2 and WinUI 2.7

@michael-hawker michael-hawker added the DataGrid 🔠 Issues on DataGrid control label Sep 16, 2021
@ghost ghost added the needs attention 👋 label Nov 3, 2021
@ghost
Copy link

ghost commented Nov 3, 2021

This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.

4 similar comments
@ghost
Copy link

ghost commented Nov 18, 2021

This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.

@ghost
Copy link

ghost commented Dec 3, 2021

This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.

@ghost
Copy link

ghost commented Dec 18, 2021

This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.

@ghost
Copy link

ghost commented Jan 2, 2022

This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.

@michael-hawker
Copy link
Member

@Arlodotexe @XAML-Knight wonder if this repros for either of you? I don't think we've heard reports of this from anywhere else.

@michael-hawker
Copy link
Member

Actually, just got a notification on another issue which appears to be very similar filed on the platform here: microsoft/microsoft-ui-xaml#2545

@Sergio0694 do you remember context here? Did it go away targeting a newer platform version? @omikhailov have you tried updating to the latest SDK, Toolkit, and WinUI versions since?

@omikhailov
Copy link
Author

omikhailov commented Jan 11, 2022

@omikhailov have you tried updating to the latest SDK, Toolkit, and WinUI versions since?

Just tried and it didn't resolve the issue as well as updating Windows to 19044.1415

@XAML-Knight
Copy link
Contributor

Confirming the runtime error in the Hamburger app.

@ghost
Copy link

ghost commented Jan 26, 2022

This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.

@michael-hawker michael-hawker added bug 🐛 An unexpected issue that highlights incorrect behavior external ⤴️ Requires an update to an external dependency or due to code outside the Toolkit. WinUI 💠 Related to WinUI 3 Version or when paired with External can mean requires fix in WinUI 2/3. help wanted Issues identified as good community contribution opportunities and removed needs triage 🔍 needs attention 👋 labels Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior DataGrid 🔠 Issues on DataGrid control external ⤴️ Requires an update to an external dependency or due to code outside the Toolkit. help wanted Issues identified as good community contribution opportunities question ❔ Issues or PR require more information WinUI 💠 Related to WinUI 3 Version or when paired with External can mean requires fix in WinUI 2/3.
Projects
None yet
Development

No branches or pull requests

3 participants