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

TypeInitializationException in PointCollection regression in 0.8.2 #971

Closed
Marv51 opened this issue Aug 15, 2021 · 7 comments · Fixed by #979
Closed

TypeInitializationException in PointCollection regression in 0.8.2 #971

Marv51 opened this issue Aug 15, 2021 · 7 comments · Fixed by #979
Assignees
Labels
bug Something isn't working fixed Issue has been fixed in an upcoming or existing release
Milestone

Comments

@Marv51
Copy link

Marv51 commented Aug 15, 2021

Describe the bug
Crashing exception in PointCollection introduced in 0.8.2

Steps to reproduce the bug

var pc = new PointCollection();

Adding this line to an empty WinUI 3 desktop project results in an exception:
System.TypeInitializationException: The type initializer for '<SignatureCache>System.Collections.Generic.IList'1<Windows.Foundation.Point>' threw an exception.'

With inner exception:
TypeLoadException: Could not load type 'ABI.Windows.Foundation.Point' from assembly 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'.

Stack Trace

   at <GuidPatcherImplementationDetails>.<IIDData>System.Collections.Generic.IList`1<Windows.Foundation.Point>()
   at Microsoft.UI.Xaml.Media.PointCollection..ctor(IObjectReference objRef)
   at Microsoft.UI.Xaml.Media.PointCollection..ctor()
   at App12.MainWindow.myButton_Click(Object sender, RoutedEventArgs e) in C:\Users\Marvin\source\repos\App12\App12\MainWindow.xaml.cs:line 34
   at WinRT._EventSource_global__Microsoft_UI_Xaml_RoutedEventHandler.EventState.<GetEventInvoke>b__1_0(Object sender, RoutedEventArgs e)
   at ABI.Microsoft.UI.Xaml.RoutedEventHandler.<>c__DisplayClass10_0.<Do_Abi_Invoke>b__0(RoutedEventHandler invoke)
   at WinRT.ComWrappersSupport.MarshalDelegateInvoke[T](IntPtr thisPtr, Action`1 invoke)
   at ABI.Microsoft.UI.Xaml.RoutedEventHandler.Do_Abi_Invoke(IntPtr thisPtr, IntPtr sender, IntPtr e)

Version Info

NuGet package version:
WinUI 3 - Windows App SDK 0.8: 0.8.2
Was working in 0.8.1

Windows app type:

UWP Win32
Yes
Windows version Saw the problem?
Insider Build (xxxxx)
21H1 (19043) Yes
October 2020 Update (19042)
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
Clear regression, most likely CsWinRT related. Impact: Crash on launch, blocks us completely.

@Marv51
Copy link
Author

Marv51 commented Aug 15, 2021

Sorry for posting unfinished issue at first, GitHub submitted prematurely.

@anawishnoff Any chance you could add 21H1 (19043) to the Windows version table in the issue template? Having to add that row manually every time for the current public release is getting a bit old at this point.

@marcelwgn
Copy link

@Marv51 Created microsoft/microsoft-ui-xaml#5693 to fix the missing OS version :)

@llongley
Copy link
Member

@Scottj1s Possible C#/WinRT projection issue?

@Marv51
Copy link
Author

Marv51 commented Aug 18, 2021

Looks very much like a regression in #849. However, setting CsWinRTIIDOptimizerOptOut on the consuming app did not resolve the exception.

@Scottj1s
Copy link
Member

Setting CsWinRTIIDOptimizerOptOut won't help here - the problem is in Microsoft.WinUI.dll (WinUI 3 projection assembly).

The IIDOptimizer should be rewriting the type reference to ABI.Windows.Foundation.Point as coming from winrt.runtime.dll, not Microsoft.WinUI.dll

@angelazhangmsft angelazhangmsft added this to the Release 1.3.5 milestone Aug 23, 2021
@Marv51
Copy link
Author

Marv51 commented Aug 23, 2021

@j0shuams Did you already have a chance to look at this? Are you able to reproduce the crash?

This issue is very important for me as it makes the Microsoft.UI.Xaml.Shapes.Polygon class in WinUI unusable. Unfortunately, my app uses polygons in quite a few critical places.

@j0shuams
Copy link
Contributor

j0shuams commented Aug 25, 2021

@Marv51 Hi, I have just returned from vacation and am starting in on this. Thanks for your patience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed Issue has been fixed in an upcoming or existing release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants