We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am trying to port my Toolkit 7 usage over to version 8. I am using a PipelineBuilder to create a tiled brush.
This fails currently (was working before) with a NullReferenceException.
I have traced back the origin of that exception to this line in the SurfaceLoader
var compositor = Window.Current.Compositor;
There must be another way to get the Compositor in WinUI 3, because Window.Current is always null in WinUI 3.
Not sure if this is still the preferred approach, but in the old repo, the WinUI branch looks like this:
var compositor = CompositionTarget.GetCompositorForCurrentThread();
https://github.com/CommunityToolkit/WindowsCommunityToolkit/blob/a10204e648c372f6a6837c5aa40065761847132e/CommunityToolkit.WinUI.UI.Media/Helpers/SurfaceLoader.cs#L45C13-L45C80
This is a pretty obviously an oversight when porting the UWP code, but here is my code just in case:
Uri _transparentBackground = new Uri("ms-appx:///Images/TransparentBackground.png"); var builder = PipelineBuilder.FromTiles(_transparentBackground, DpiMode.DisplayDpiWith96AsLowerBound); var brush = builder .Shade(Colors.Red, 0.5f) .AsBrush();
No exception expected.
No response
I found a lot of Window.Current.Compositor instances in this part of the code.
Window.Current.Compositor
Is a #if WINUI3 the preferred approach?
#if WINUI3
I'd prefer someone else to look at this, so that it can be addressed in a timely manner, because I am not at all familiar with the new tooling.
The text was updated successfully, but these errors were encountered:
Thanks for the report @Marv51, yeah, this got missed in the port. Not sure how as we were comparing against the winui branch. FYI @Arlodotexe.
Sorry, something went wrong.
Possibly related to #235
Successfully merging a pull request may close this issue.
Describe the bug
I am trying to port my Toolkit 7 usage over to version 8. I am using a PipelineBuilder to create a tiled brush.
This fails currently (was working before) with a NullReferenceException.
I have traced back the origin of that exception to this line in the SurfaceLoader
var compositor = Window.Current.Compositor;
There must be another way to get the Compositor in WinUI 3, because Window.Current is always null in WinUI 3.
Not sure if this is still the preferred approach, but in the old repo, the WinUI branch looks like this:
var compositor = CompositionTarget.GetCompositorForCurrentThread();
https://github.com/CommunityToolkit/WindowsCommunityToolkit/blob/a10204e648c372f6a6837c5aa40065761847132e/CommunityToolkit.WinUI.UI.Media/Helpers/SurfaceLoader.cs#L45C13-L45C80
Steps to reproduce
This is a pretty obviously an oversight when porting the UWP code, but here is my code just in case:
Expected behavior
No exception expected.
Screenshots
No response
Code Platform
Windows Build Number
Other Windows Build number
No response
App minimum and target SDK version
Other SDK version
No response
Visual Studio Version
No response
Visual Studio Build Number
No response
Device form factor
No response
Additional context
I found a lot of
Window.Current.Compositor
instances in this part of the code.Is a
#if WINUI3
the preferred approach?Help us help you
I'd prefer someone else to look at this, so that it can be addressed in a timely manner, because I am not at all familiar with the new tooling.
The text was updated successfully, but these errors were encountered: