CsWinRT: System.ExecutionEngineException

HResult=0x80131506

>	System.Private.CoreLib.dll!System.Runtime.InteropServices.Marshal.PtrToStructureHelper(System.IntPtr ptr, System.Type structureType) Line 203	C#
 	System.Private.CoreLib.dll!System.Runtime.InteropServices.Marshal.PtrToStructure(System.IntPtr ptr, System.Type structureType) Line 560	C#
 	System.Private.CoreLib.dll!System.Runtime.InteropServices.Marshal.PtrToStructure<WinRT.Interop.IUnknownVftbl>(System.IntPtr ptr) Line 580	C#
 	WinRT.Runtime.dll!WinRT.ObjectReference<WinRT.Interop.IUnknownVftbl>.GetVtables(System.IntPtr thisPtr) Line 210	C#
 	WinRT.Runtime.dll!WinRT.ObjectReference<WinRT.Interop.IUnknownVftbl>.FromAbi(System.IntPtr thisPtr) Line 200	C#
 	WinRT.Runtime.dll!WinRT.MarshalInspectable.FromAbi(System.IntPtr ptr) Line 953	C#
 	WinRT.Runtime.dll!WinRT.MarshalInterface<Windows.Foundation.IAsyncOperation<System.Collections.Generic.IReadOnlyList<Windows.Storage.IStorageItem>>>.FromAbi(System.IntPtr ptr) Line 799	C#
 	Microsoft.Windows.SDK.NET.dll!ABI.Windows.Foundation.AsyncOperationCompletedHandler<System.Collections.Generic.IReadOnlyList<Windows.Storage.IStorageItem>>.Do_Abi_Invoke.AnonymousMethod__0(System.Delegate invoke)	Unknown
 	WinRT.Runtime.dll!WinRT.ComWrappersSupport.MarshalDelegateInvoke<System.Delegate>(System.IntPtr thisPtr, System.Action<System.Delegate> invoke) Line 62	C#
 	Microsoft.Windows.SDK.NET.dll!ABI.Windows.Foundation.AsyncOperationCompletedHandler<System.Collections.Generic.IReadOnlyList<Windows.Storage.IStorageItem>>.Do_Abi_Invoke(void* thisPtr, System.IntPtr asyncInfo, Windows.Foundation.AsyncStatus asyncStatus)	Unknown

Which happened with this source:

var proxyType = Microsoft.UI.Xaml.VerticalAlignment.Center;
var assembly = proxyType.GetType().GetTypeInfo().Assembly;

foreach (var typeInfo in assembly.**ExportedTypes**)
...

System.Private.CoreLib.dll!System.Reflection.RuntimeAssembly.GetExportedTypes() Line 192 C#

System.Private.CoreLib.dll!System.Reflection.Assembly.ExportedTypes.get() Line 72 C# Microsoft.Toolkit.Uwp.SampleApp.dll!Microsoft.Toolkit.Uwp.SampleApp.Sample.LookForTypeByName(string typeName) Line 660 C# Microsoft.Toolkit.Uwp.SampleApp.dll!Microsoft.Toolkit.Uwp.SampleApp.Sample.PreparePropertyDescriptorAsync() Line 572 C#

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (13 by maintainers)

Most upvoted comments

Thank you very much for the confirmation, I was very close to losing my mind trying to figure it out and really confused that I seemed to be the only one tripping over it left and right w/ the WinUI 3 preview release.

.NET 5 runtime builds version 5.0.0-preview.6.20262.3 or later have the fix.

Thanks for clarifying! I’ll take a look and fixing this tomorrow.