question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resizetizer cannot find existing images

See original GitHub issue

Description

We are working on an iOS app that is consuming a nuget package, and resizetizer is having issues finding the images from the library. We are specifically getting:

  Microsoft.Maui.Resizetizer.targets(531, 9): Unable to find background file: /Users/matthericks/.nuget/packages/matthericks.maui.imagepackage/0.0.1/buildTransitive/Resources/Images/checkmark.svg
   at Microsoft.Maui.Resizetizer.ResizeImageInfo.Parse(IEnumerable`1 images) in D:\a\_work\1\s\src\SingleProject\Resizetizer\src\ResizeImageInfo.cs:line 67
   at Microsoft.Maui.Resizetizer.ResizetizeImages.ExecuteAsync()
   at Microsoft.Maui.Resizetizer.MauiAsyncTask.<Execute>b__0_0() in D:\a\_work\1\s\src\SingleProject\Resizetizer\src\MauiAsyncTask.cs:line 18
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)

The image exists in the specified location: Screen Shot 2022-09-28 at 1 36 46 PM

We have followed steps here to get our library to properly pack the images.

We have also tried clearing out bin and obj folders with no improvements.

currently using .NET SDK 6.0.401

Created a public nuget package for repro: https://www.nuget.org/packages/MattHericks.MAUI.ImagePackage/

Steps to Reproduce

  1. Create library with images
  2. Consume library in another MAUI app
  3. note build errors in resizetizer

Expected behavior: -resizetizer can find existing images

Actual behavior:

  • Resizetizer throw error saying that images cannot be found.

Link to public reproduction project repository

https://github.com/matthericks/bug_repro

Version with bug

Unknown/Other (please specify)

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 15.4

Did you find any workaround?

no

Relevant log output

Microsoft.Maui.Resizetizer.targets(531, 9): Unable to find background file: /Users/matthericks/.nuget/packages/matthericks.maui.imagepackage/0.0.1/buildTransitive/Resources/Images/checkmark.svg
   at Microsoft.Maui.Resizetizer.ResizeImageInfo.Parse(IEnumerable`1 images) in D:\a\_work\1\s\src\SingleProject\Resizetizer\src\ResizeImageInfo.cs:line 67
   at Microsoft.Maui.Resizetizer.ResizetizeImages.ExecuteAsync()
   at Microsoft.Maui.Resizetizer.MauiAsyncTask.<Execute>b__0_0() in D:\a\_work\1\s\src\SingleProject\Resizetizer\src\MauiAsyncTask.cs:line 18
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mattleibowcommented, Sep 30, 2022

I had a look at the package and had to make 2 changes:

move the Resources folder under buildTransitive and then move the targets file to the root of the buildTransitive (out of the Resources)

    <ItemGroup>
        <None Include="Resources\Images\checkmark.svg" Pack="True" PackagePath="buildTransitive\Resources\Images\" />
        <None Include="Resources\MattHericks.MAUI.ImagePackage.targets" Pack="True" PackagePath="buildTransitive\" />
    </ItemGroup>
0reactions
mattherickscommented, Sep 30, 2022

As a general workflow thought, it would be nice if indicating that a .svg file should be packaged managed a bit of this in the background. Manually editing the project file is not ideal, and gets overwritten quite easily when files are added/changed, making maintaining this a bit of a pain.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resizetizer One or more invalid file names were detected
Simplest fix is to create a new project. Copy stuff over gradually. Other ideas: .vs hidden folder. .csproj itself. If you hadn't deleted...
Read more >
Maui, files go locked and even Resource Monitor cannot ...
IOException : The process cannot access the file 'C:\Visual Stuido Stuff\Maui\DEVEXFullProject\obj\Debug\net6.0-android\resizetizer\r\drawable- ...
Read more >
How-To: Get Started with Uno.Resizetizer
Configure the project to use generated Images. In the App Class library, create a folder called Assets (if doesn't exist) and then create...
Read more >
,NET MAUI GIVING ERRORS AFTER UPDATING FROM ...
I have VS 2022 17.3 installed and created a lot fo MAUi APps that are working well but when i updated VS to...
Read more >
NET MAUI App Stopped Working -- HELP!
Try cleaning your obj and bin folders, which might fix the current state of your project. By clean, I mean delete them from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found