IImageLoadingService cannot load image on Windows
See original GitHub issueDescription
What I was trying to achieve:
- resize an image selected from PC using MAUI on Windows
Result:
- I didn’t get past loading the file as
IImage
Sample application:
MauiApp2 Android IImage resized image disposed exception.zip (yes, the same as for https://github.com/dotnet/maui/issues/6909)
Description
Any attempt to load an image using IImageLoadingService on Windows results in this code being called:

"No resource creator has been registered globally or for this thread."
Exception thrown: 'System.Exception' in Microsoft.Maui.Graphics.Win2D.WinUI.Desktop.dll
An exception of type 'System.Exception' occurred in Microsoft.Maui.Graphics.Win2D.WinUI.Desktop.dll but was not handled in user code
No resource creator has been registered globally or for this thread.
How I am calling it:

imageLoadingService.FromStream which is Microsoft.Maui.Graphics.Win2D.SkiaImageLoadingService which is the only IImageLoadingService implementation which works for me for Windows (during compile-time).
Win2DImage cannot be called directly because it is an internal class.
What I am doing in MauiProgram.cs:
#if WINDOWS
services.AddSingleton<IImageLoadingService, Microsoft.Maui.Graphics.Win2D.SkiaImageLoadingService>();
#endif
#if ANDROID
services.AddSingleton<IImageLoadingService, Microsoft.Maui.Graphics.Platform.PlatformImageLoadingService>();
#endif
Steps to Reproduce
Inject Microsoft.Maui.Graphics.Win2D.SkiaImageLoadingService for IImageLoadingService on Windows and try creating an IImage from file/stream with it.
Version with bug
Release Candidate 2 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
I don’t know.
Did you find any workaround?
No response
Relevant log output
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:6
- Comments:7

Top Related StackOverflow Question
I found a workaround. Put a dummy GraphicsView on the page somewhere where it loads first and handle the Loaded event with this:
I actually get a COM error the first time I try to load an image, but after the first one (handled via try…catch) it works fine. All of the images load. Maybe there’s a timing issue still, but it works for me… at least to get to the next stage of working on my app.
This is just to load an stream into an
IImage. The error you get comes from the GlobalCreator property being always null. Once you populate it with an actualCanvasControlfrom Win2D, then the loading a stream into anIImageworks.My dummy GraphicsView is 1 pixel by 1 pixel and it’s covered by other controls. The windows version of GraphicsView uses a CanvasControl internally.
Somewhere later in my code, I’m doing this to load an image into an
IImage:Again, I do get an initial COM error when trying the above code, but it works eventually. (My app is loading several pages from a pdf file as images and displaying them. If it can’t get the image, it tries again at the next draw call when the GraphicsView is Invalidated. So this works for me…)