Maui icon indicating copy to clipboard operation
Maui copied to clipboard

fixed sample application crashed with MediaElement for Windows

Open olekssokol opened this issue 9 months ago • 2 comments

Sample application crashed in MediaElement page when the "Tab" key switches the active state to the "Change Aspect" button, and then the "Space" key executes it. In this case, the problem is due to the DisplayActionSheet call from the Microsoft.Maui.Controls package, it should display the window and return the pressed button, but instead of the window, it immediately returns null, which was not handled in the Sample project.

olekssokol avatar May 09 '24 08:05 olekssokol

@dotnet-policy-service agree

olekssokol avatar May 09 '24 09:05 olekssokol

Adding the blocked tag.

Do not merge this PR until Microsoft.Maui.Controls v8.0.21 is included in the Visual Studio (stable) release.

brminnick avatar May 09 '24 12:05 brminnick

Dang - in Microsoft.Maui.Controls v8.0.21 there is a breaking change in how Application is loaded which is breaking our Unit Tests. There's an internal field in Application that needs to be initialized before our tests can run: readonly Lazy<IResourceDictionary> _systemResources;. Currently it is throwing a NullReferenceException.

brminnick avatar Jun 06 '24 16:06 brminnick

Dang - in Microsoft.Maui.Controls v8.0.21 there is a breaking change in how Application is loaded which is breaking our Unit Tests. There's an internal field in Application that needs to be initialized before our tests can run: readonly Lazy<IResourceDictionary> _systemResources;. Currently it is throwing a NullReferenceException.

I was able to use reflection as a workaround.

The root cause of this bug fix is that .NET MAUI is now using partial classes for Application, and the .NET Standard implementation of Application doesn't initialize the _systemResources field.

brminnick avatar Jun 14 '24 14:06 brminnick

Ok - there's one more bug we need to fix with the AppTheme test now.

I just spent the last few hours digging into it and couldn't figure it out. @olekssokol any chance you could take a look?

brminnick avatar Jun 14 '24 15:06 brminnick

Yes, of course, I'll take a look at it

olekssokol avatar Jun 16 '24 14:06 olekssokol