Skip to content
New issue

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

MAUI Resizetizer 'file is being used by another process' error when referencing a .NET MAUI App from another .NET MAUI App #14082

Closed
wqotipo5 opened this issue Mar 20, 2023 · 15 comments
Labels
area-single-project Splash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizer s/needs-attention Issue has more information and needs another look s/no-repro Can no longer be reproduced on latest t/bug Something isn't working

Comments

@wqotipo5
Copy link

Description

Getting "process cannot access the file because it is being used by another process" error when building a .NET MAUI App that has a reference to another .NET MAUI App.

Appears to be the same issue as #12653 which was closed due to no activity.

Steps to Reproduce

  1. New Project > .NET MAUI App
  2. Solution > Add > New Project > .NET MAUI App
  3. First Project > Dependencies > Add Project Reference > Second Project > OK
  4. Build Solution

Expected outcome: The solution successfully builds
Actual outcome: System.IO.IOException: The process cannot access the file 'C:...\obj\Debug\net7.0-android\resizetizer\r\drawable-mdpi\slash.png' because it is being used by another process.

image

Link to public reproduction project repository

https://github.com/wqotipo5/ResizetizerIssue

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

I was not able test on other platforms

Affected platform versions

Windows 10.0.19044

Did you find any workaround?

No response

Relevant log output

No response

@wqotipo5 wqotipo5 added the t/bug Something isn't working label Mar 20, 2023
@jsuarezruiz jsuarezruiz added the area-single-project Splash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizer label Mar 21, 2023
@Ghostbird
Copy link
Contributor

I'm having this error a lot on clean builds, not referring to another MAUI app. However it only happens on clean builds, and only on the local machine. Clean CI builds in run without issue. When it occurs locally, I just try again a few times, and once it works and the good value is cached, the problem doesn't reoccur until I clean again. I have no idea why it happens like that, and how relevant it is, but maybe this information can be used to narrow down the issue?

@mattleibow
Copy link
Member

I think this is because you have 2 files with the same name? Are there multiple files named dotnet_bot in the app/library?

When it works, it is just the last one winning and it is arbitrary. If the images are different, you will end up with different images in the app each time.

@mattleibow mattleibow added the s/needs-info Issue needs more info from the author label Apr 3, 2023
@ghost
Copy link

ghost commented Apr 3, 2023

Hi @wqotipo5. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@mattleibow
Copy link
Member

Looking at your attached issue, I see 2 dotnet_bot files. As a result, the image processor is trying to process both at the same time and the file is locked.

Is the images with the same name a desired feature? What would you use it for?

Or is it just a coincidence?

@ghost ghost added the s/no-recent-activity Issue has had no recent activity label Apr 7, 2023
@ghost
Copy link

ghost commented Apr 7, 2023

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

@Ghostbird
Copy link
Contributor

Probably a different issue than mine then. I definitely don't have multiple files with the same name.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author s/no-recent-activity Issue has had no recent activity labels Apr 8, 2023
@mattleibow
Copy link
Member

Probably a different issue than mine then. I definitely don't have multiple files with the same name.

Can you attach a binlog? Maybe there is another issue somewhere.

@Ghostbird
Copy link
Contributor

Probably a different issue than mine then. I definitely don't have multiple files with the same name.

Can you attach a binlog? Maybe there is another issue somewhere.

I'll get back to this once I encounter it again. That's bound to happen on Monday or Tuesday as I have to release an update of our app built with API 33 now that the service release is out 🎉

@Ghostbird
Copy link
Contributor

I haven't encountered this again, even though it happened quite often before. I'll tentatively call it fixed in the latest MAUI 7.0 service release.

@mattleibow
Copy link
Member

OK, let me close and maybe open a new issue if it happens again. I think what we will need is what projects have maui images/icons and see if there are any duplicate names across app/library projects.

@samhouts samhouts added the s/no-repro Can no longer be reproduced on latest label May 12, 2023
@n3oea
Copy link

n3oea commented Jun 4, 2023

This is unfortunately an example of how MAUI simply is not yet mature. I received this exact same error by following the resolution for another issue. Initially I could not deploy to Android because it said it could not find a splash image. Android wants a MauiImage, not a MauiSplashScreen for some reason. So I copy over the splash.svg file and make it a MauiImage. Then when I try to build on iOS, I get this error.

The solution is inelegant and trivial - rename the Android image splash2.svg. Still this is quite frustrating.

@ghost
Copy link

ghost commented Jun 4, 2023

Hello lovely human, thank you for your comment on this issue. Because this issue has been closed for a period of time, please strongly consider opening a new issue linking to this issue instead to ensure better visibility of your comment. Thank you!

@MattsProjects
Copy link

I too face this exact issue fairly often. not on every build, but maybe 1/3 of them. And I have no duplicate image files at all (actually just the default images + one png file I use). Curious if anyone else is still facing this and found a solution.

@ghost
Copy link

ghost commented Jun 14, 2023

Hello lovely human, thank you for your comment on this issue. Because this issue has been closed for a period of time, please strongly consider opening a new issue linking to this issue instead to ensure better visibility of your comment. Thank you!

@ghost
Copy link

ghost commented Jun 15, 2023

I also got this error "System.IO.IOException: The process cannot access the file 'C:\MobileApps\app.baf-erp.com\App\Consumer\obj\Debug\net8.0-android\lp\148\jl\classes.jar' because it is being used by another process". This will be fixed if I will build 3 to 4 times. But still, it's frustrating, and feel like whether to switch back to Android Studio. both Xamarin and now MAUI is very slow when you compare other .NET application like Web API etc. Please fix it as just because we love c# and dotnet, we are yet hopeful as one day Microsoft will fix it but it's been almost a year now.

@ghost ghost locked as resolved and limited conversation to collaborators Jul 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-single-project Splash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizer s/needs-attention Issue has more information and needs another look s/no-repro Can no longer be reproduced on latest t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants