'Setting MauiSplashScreen tag on MyMauiProject.csproj with a mp4 file throw null exception from Resizetizer/SkiaSharpBitmapTools, looks hardcoded trash
Setting the MauiSplashScreen tag inside my net6.0 MyMauiProject.csproj pointing to a mp4 file makes it throw a null exception from Resizetizer/SkiaSharpBitmapTools. It looks like hardcoded trash from Microsoft. I don't even have a 'D:' drive on my machine, just 'C:', but the error points to D:\a\1\s\src\SingleProject\Resizetizer\src\SkiaSharpBitmapTools.cs:line 29
, a project I never created.
Was searching like a crazy on google, but there is nothing about it.
Even after it changes back to a gif and also changes to a svg, the error stays there.
Thinking about recreating the project and copying my source code to see if it fixes it, but I cant do it every time and that isn't a good solution.
I'm on a tight deadline project. I can't do in on Xamarin Forms because MS is discontinuing it and looks I can't do on MAUI too.
Severity Code Description Project File Line Suppression State
Error MAUI0000 System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Maui.Resizetizer.SkiaSharpBitmapTools.GetOriginalSize() in D:\a\1\s\src\SingleProject\Resizetizer\src\SkiaSharpBitmapTools.cs:line 29
at Microsoft.Maui.Resizetizer.SkiaSharpTools.Resize(DpiPath dpi, String destination) in D:\a\1\s\src\SingleProject\Resizetizer\src\SkiaSharpTools.cs:line 47
at Microsoft.Maui.Resizetizer.Resizer.Resize(DpiPath dpi, String inputsFile) in D:\a\1\s\src\SingleProject\Resizetizer\src\Resizer.cs:line 101
at Microsoft.Maui.Resizetizer.ResizetizeImages.ProcessImageResize(ResizeImageInfo img, DpiPath[] dpis, ConcurrentBag`1 resizedImages) in D:\a\1\s\src\SingleProject\Resizetizer\src\ResizetizeImages.cs:line 172
at Microsoft.Maui.Resizetizer.ResizetizeImages.<>c__DisplayClass26_0.<ExecuteAsync>b__0(ResizeImageInfo img) in D:\a\1\s\src\SingleProject\Resizetizer\src\ResizetizeImages.cs:line 88
at Microsoft.Maui.Resizetizer.AsyncTaskExtensions.<>c__DisplayClass0_0`1.<ParallelForEach>b__0(TSource s) in D:\a\1\s\src\SingleProject\Resizetizer\src\AsyncTaskExtensions.cs:line 21 MyMauiProject C:\Users\MySelf\.nuget\packages\microsoft.maui.resizetizer.sdk\6.0.101-preview.11.2349\build\Microsoft.Maui.Resizetizer.Sdk.targets 463
When clicking on the error, the IDE points to:
<!-- Resize the images -->
<ResizetizeImages
PlatformType="$(ResizetizerPlatformType)"
IntermediateOutputPath="$(_MauiIntermediateImages)"
InputsFile="$(_ResizetizerInputsFile)"
Images="@(MauiImage->Distinct())">
</ResizetizeImages>
I never ever touched on this block.
Closing and opening Visual Studio/Project doesnt fix it either.
It looks like it's pointing to here.
Solution 1:[1]
Another person had a related error here, the solution was reinstall all environment.
I Think you realized the error isnt with your code but with: C:\Users\MySelf\.nuget\packages\microsoft.maui.resizetizer.sdk\6.0.101-preview.11.2349
Solution 2:[2]
I had exactly the same issue. The problem was that I had a non-image file (ie a file called list.txt) in the Resources/Images folder.
Removing the file fixed the issue and the code ran correctly.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mark |
Solution 2 | OldH |