After testing the fix for #4126
Trying to get the DeviceDisplay.MainDisplayInfo
Trying to get the DeviceDisplay.MainDisplayInfo throws
DeviceDisplay.MainDisplayInfo' threw an exception of type 'System.ArgumentException' Data: {System.Collections.ListDictionaryInternal} HResult: -2147024809 HelpLink: null InnerException: null Message: "Source object type is not a projected type and does not inherit from a projected type. (Parameter 'value')" ParamName: "value" Source: "WinRT.Runtime" StackTrace: " at WinRT.CastExtensions.GetRefForObject(Object value)\r\n at WinRT.CastExtensions.As[TInterface](Object value)\r\n at WinRT.Interop.WindowNative.GetWindowHandle(Object target)\r\n at Microsoft.Maui.Essentials.Platform.get_CurrentWindowHandle()\r\n at Microsoft.Maui.Essentials.Platform.get_CurrentWindowId()\r\n at Microsoft.Maui.Essentials.Platform.get_CurrentAppWindow()\r\n at Microsoft.Maui.Essentials.DeviceDisplayImplementation.GetMainDisplayInfo()\r\n at Microsoft.Maui.Essentials.DeviceDisplay.get_MainDisplayInfo()" TargetSite: {WinRT.IObjectReference GetRefForObject(System.Object)}
After testing the fix for #4125
Calling DeviceDisplay.MainDisplayInfoChanged += DeviceDisplay_MainDisplayInfoChanged throws
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(EventHandler1 value) at Microsoft.Maui.Controls.Application.SendStart() at Microsoft.Maui.Controls.Window.Microsoft.Maui.IWindow.Created() at Microsoft.Maui.LifecycleEvents.AppHostBuilderExtensions.<>c.b__1_0(Window window) at Microsoft.Maui.Platform.ApplicationExtensions.<>c__DisplayClass1_0.b__1(OnWindowCreated del) at Microsoft.Maui.LifecycleEvents.LifecycleEventServiceExtensions.InvokeLifecycleEvents[TDelegate](IServiceProvider services, Action1 action)
at Microsoft.Maui.Platform.ApplicationExtensions.CreateNativeWindow(Application nativeApplication, IApplication application, OpenWindowRequest args)
at Microsoft.Maui.Platform.ApplicationExtensions.CreateNativeWindow(Application nativeApplication, IApplication application, LaunchActivatedEventArgs args)
at Microsoft.Maui.MauiWinUIApplication.OnLaunched(LaunchActivatedEventArgs args)
at Microsoft.UI.Xaml.Application.Microsoft.UI.Xaml.IApplicationOverrides.OnLaunched(LaunchActivatedEventArgs args)
at ABI.Microsoft.UI.Xaml.IApplicationOverrides.Do_Abi_OnLaunched_0(IntPtr thisPtr, IntPtr args)
`
Steps to Reproduce
Issue 1.
Create Maui Project
In Windows Platform call DeviceDisplay.MainDisplayInfo
Description
After testing the fix for #4126 Trying to get the DeviceDisplay.MainDisplayInfo
Trying to get the DeviceDisplay.MainDisplayInfo throws
DeviceDisplay.MainDisplayInfo' threw an exception of type 'System.ArgumentException' Data: {System.Collections.ListDictionaryInternal} HResult: -2147024809 HelpLink: null InnerException: null Message: "Source object type is not a projected type and does not inherit from a projected type. (Parameter 'value')" ParamName: "value" Source: "WinRT.Runtime" StackTrace: " at WinRT.CastExtensions.GetRefForObject(Object value)\r\n at WinRT.CastExtensions.As[TInterface](Object value)\r\n at WinRT.Interop.WindowNative.GetWindowHandle(Object target)\r\n at Microsoft.Maui.Essentials.Platform.get_CurrentWindowHandle()\r\n at Microsoft.Maui.Essentials.Platform.get_CurrentWindowId()\r\n at Microsoft.Maui.Essentials.Platform.get_CurrentAppWindow()\r\n at Microsoft.Maui.Essentials.DeviceDisplayImplementation.GetMainDisplayInfo()\r\n at Microsoft.Maui.Essentials.DeviceDisplay.get_MainDisplayInfo()" TargetSite: {WinRT.IObjectReference GetRefForObject(System.Object)}
After testing the fix for #4125 Calling DeviceDisplay.MainDisplayInfoChanged += DeviceDisplay_MainDisplayInfoChanged throws
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(EventHandler1 value) at Microsoft.Maui.Controls.Application.SendStart() at Microsoft.Maui.Controls.Window.Microsoft.Maui.IWindow.Created() at Microsoft.Maui.LifecycleEvents.AppHostBuilderExtensions.<>c.b__1_0(Window window) at Microsoft.Maui.Platform.ApplicationExtensions.<>c__DisplayClass1_0.b__1(OnWindowCreated del) at Microsoft.Maui.LifecycleEvents.LifecycleEventServiceExtensions.InvokeLifecycleEvents[TDelegate](IServiceProvider services, Action
1 action) at Microsoft.Maui.Platform.ApplicationExtensions.CreateNativeWindow(Application nativeApplication, IApplication application, OpenWindowRequest args) at Microsoft.Maui.Platform.ApplicationExtensions.CreateNativeWindow(Application nativeApplication, IApplication application, LaunchActivatedEventArgs args) at Microsoft.Maui.MauiWinUIApplication.OnLaunched(LaunchActivatedEventArgs args) at Microsoft.UI.Xaml.Application.Microsoft.UI.Xaml.IApplicationOverrides.OnLaunched(LaunchActivatedEventArgs args) at ABI.Microsoft.UI.Xaml.IApplicationOverrides.Do_Abi_OnLaunched_0(IntPtr thisPtr, IntPtr args) `Steps to Reproduce
Issue 1.
Issue 2.
Version with bug
Preview 12 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
Window SDK 10.0.19041.0
Did you find any workaround?
No response
Relevant log output
No response