Closed PedroCigaw closed 2 years ago
This should be fixed in P12
Tested in P12 now I get
System.ArgumentException HResult=0x80070057 Message=Source object type is not a projected type and does not inherit from a projected type. Arg_ParamName_Name Source=WinRT.Runtime StackTrace: at WinRT.CastExtensions.GetRefForObject(Object value) at WinRT.CastExtensions.As[TInterface](Object value) at WinRT.Interop.WindowNative.GetWindowHandle(Object target) at Microsoft.Maui.Essentials.Platform.get_CurrentWindowHandle() at Microsoft.Maui.Essentials.Platform.get_CurrentWindowId() at Microsoft.Maui.Essentials.Platform.get_CurrentAppWindow() at Microsoft.Maui.Essentials.DeviceDisplayImplementation.GetMainDisplayInfo() at Microsoft.Maui.Essentials.DeviceDisplay.add_MainDisplayInfoChanged(EventHandler
1 value)
at Microsoft.Maui.Controls.Application.SendStart()
at Microsoft.Maui.Controls.Window.Microsoft.Maui.IWindow.Created()
at Microsoft.Maui.LifecycleEvents.AppHostBuilderExtensions.<>c.
`
Description
Calling DeviceDisplay.MainDisplayInfoChanged += DeviceDisplay_MainDisplayInfoChanged causes COMException on windowss
Steps to Reproduce
Version with bug
Preview 11
Last version that worked well
Unknown/Other
Affected platforms
Windows, I was not able test on other platforms
Affected platform versions
Window SDK 10.0.19041.0
Did you find any workaround?
{"Element not found. (0x80070490)"} Data: {System.Collections.ListDictionaryInternal} ErrorCode: -2147023728 HResult: -2147023728 HelpLink: null InnerException: null Message: "Element not found. (0x80070490)" Source: "WinRT.Runtime" StackTrace: " at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|20_0(Int32 hr)\r\n at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr)\r\n at ABI.Windows.Graphics.Display.IDisplayInformationStaticsMethods.GetForCurrentView(IObjectReference _obj)\r\n at Windows.Graphics.Display.DisplayInformation.GetForCurrentView()\r\n at Microsoft.Maui.Essentials.DeviceDisplayImplementation.GetMainDisplayInfo(DisplayInformation di)\r\n at Microsoft.Maui.Essentials.DeviceDisplayImplementation.GetMainDisplayInfo()\r\n at Microsoft.Maui.Essentials.DeviceDisplay.add_MainDisplayInfoChanged(EventHandler
1 value)\r\n at ) in App.OnStart() in App.xaml.cs:line 81\r\n at Microsoft.Maui.Controls.Application.SendStart()\r\n at Microsoft.Maui.Controls.Window.Microsoft.Maui.IWindow.Created()\r\n at Microsoft.Maui.LifecycleEvents.AppHostBuilderExtensions.<>c.1 action)\r\n at Microsoft.Maui.Platform.ApplicationExtensions.CreateNativeWindow(Application nativeApplication, IApplication application, OpenWindowRequest args)\r\n at Microsoft.Maui.Platform.ApplicationExtensions.CreateNativeWindow(Application nativeApplication, IApplication application, LaunchActivatedEventArgs args)\r\n at Microsoft.Maui.MauiWinUIApplication.OnLaunched(LaunchActivatedEventArgs args)\r\n at cigaw.App.WinUI.App.OnLaunched(LaunchActivatedEventArgs args) in C:\\repos\\cigaw.App\\src\\cigaw.App\\cigaw.App\\Platforms\\Windows\\App.xaml.cs:line 29\r\n at Microsoft.UI.Xaml.Application.Microsoft.UI.Xaml.IApplicationOverrides.OnLaunched(LaunchActivatedEventArgs args)\r\n at ABI.Microsoft.UI.Xaml.IApplicationOverrides.Do_Abi_OnLaunched_0(IntPtr thisPtr, IntPtr args)" TargetSite: {Void <ThrowExceptionForHR>g__Throw|20_0(Int32)}
Relevant log output
No response