Sporadic System.Runtime.InteropServices.COMException while attempting to get WinUI AppWindow

dg2k 1,386 Reputation points
2022-07-20T14:21:43.21+00:00

I am using a widely used C# snippet (for instance here, also same code suggested as an answer to my earlier question) to get a WinUI AppWindow for setting start-up window dimensions.

Lately I'm getting System.Runtime.InteropServices.COMException (screenshot shown below), but strangely happens only about 1 in 4 or 5 times of launching the app.

I understand that this error may not be attributed to Maui (web search shows this error has been around for long) but posting it here just in case relevant because I only came across it while migrating to Maui. Event Viewer on Windows 11 (22H2 25158.1000) indicates:

Faulting module name: CoreMessagingXP.dll, version: 10.0.22621.1002, time stamp: 0xc93a5eeb

Visual Studio is Version 17.3.0 Preview 4.0

Is this a known issue with Maui and if so what is causing this?

222783-appwindowsexception.png

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,866 questions
{count} votes

1 answer

Sort by: Most helpful
  1. dg2k 1,386 Reputation points
    2022-08-05T17:34:40.013+00:00

    This issue never resurfaced, so I would assume it is not related to Maui which is good news.
    I am just giving a closure to this question with this remark.

    0 comments No comments