-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Creating .NET MAUI Project sometimes causes error *.png is being used by another process #25374
Conversation
edb0e9f
to
9327b46
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
9327b46
to
b0ebdb8
Compare
I can't see where the issues with CI are? everything seems to be timing out? |
17a4998
to
b3068c4
Compare
b3068c4
to
1e61a7c
Compare
aec6727
to
a1114c1
Compare
a1114c1
to
24e7d3c
Compare
@mattleibow @Redth any chance we can get this in? It might help with certain build issues |
24e7d3c
to
e14431a
Compare
ups sorry didn t saw you just force pushed, I rebased again the android was hanging the 1st run taking more than 1h. lets see if it was a fluke |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
… by another process Fixes dotnet#25207 Context dotnet/android-tools#245 dotnet/android#9409 So there is a problem where the design time builds (DTB) of android sometimes lock files. This can happen when two processes try to write to the same file. This is not a great experience for our users as it just fails the build. So lets try a few things to fix this. 1. Move the Resizetizer output for a DTB into the android `$(IntermediateOutputPath)designtime` folder. This will keep the DTB files completely separate. This should prevent clashes. 2. Add some retry code to the `SkiaSharpTools.Save` method. This will catch `UnauthorizedAccessException` exceptions as well as specific `IOException` types (Access Denied and Sharing Violation). This will allow us to catch when this happens and retry the write. There is a small delay before attempting to write the file again. Note these code uses the Identical code as we are going to use in Android. We have introduced two new environment variables which can be used to control the new behavior. 1. `DOTNET_ANDROID_FILE_WRITE_RETRY_ATTEMPTS`. Integer, controls the number of times we try to write the file. The default is 10. 2. `DOTNET_ANDROID_FILE_WRITE_RETRY_DELAY_MS`. Integer, controls the delay in milliseconds between retry attempts. Default is 1000ms (or 1 second).
e14431a
to
e728410
Compare
Whats the best way to run this locally? I've tried looking at the run logs but they are corrupt ("There was an exception while reading the log file: Unable to read beyond the end of the stream.") . |
Fixes #25207
Context
dotnet/android-tools#245
dotnet/android#9409
So there is a problem where the design time builds (DTB) of android sometimes lock files. This can happen when two processes try to write to the same file. This is not a great experience for our users as it just fails the build.
So lets add some retry code to the
SkiaSharpTools.Save
method. This will catchUnauthorizedAccessException
exceptions as well as specificIOException
types (Access Denied and Sharing Violation). This will allow us to catch when this happens and retry the write. There is a small delay before attempting to write the file again.Note these code uses the Identical code as we are going to use in Android. We have introduced two new environment variables which can be used to control the new behavior.
DOTNET_ANDROID_FILE_WRITE_RETRY_ATTEMPTS
. Integer, controls the number of times we try to write the file. The default is 10.DOTNET_ANDROID_FILE_WRITE_RETRY_DELAY_MS
. Integer, controls the delay in milliseconds between retry attempts. Default is 1000ms (or 1 second).