AvaloniaVS icon indicating copy to clipboard operation
AvaloniaVS copied to clipboard

Avalonia designer prevents copying the output file on build if it is a DLL

Open OronDF343 opened this issue 7 years ago • 6 comments

This issue slows down development with Avalonia greatly for me

The Avalonia designer occasionally somehow prevents the build process from copying the output file. Once I start getting the issue it goes away if I wait a bit, and it is likely to happen on the next build as well. It is the following error:

error MSB3027: Could not copy "<project dir>\bin\Debug\netstandard2.0\<project>.UI.dll" to "..\bin\Debug_Windows\<project>.UI.dll". Exceeded retry count of 10. Failed.
error MSB3021: Unable to copy file "<project dir>\bin\Debug\netstandard2.0\<project>.UI.dll" to "..\bin\Debug_Windows\<project>.UI.dll". The requested operation cannot be performed on a file with a user-mapped section open.

The DLL above is the one which contains the code for all of the UI components and targets .NET Standard 2.0, and the main EXE targets .NET Framework 4.6.1 and just initializes the UI.

I have not experienced this issue with any other project (none of them use Avalonia).

OronDF343 avatar Nov 02 '17 14:11 OronDF343

@OronDF343 does the new version (0.8.0) work better in this respect?

grokys avatar Apr 05 '19 21:04 grokys

Not sure if any better as I haven't used the Avalonia designer much recently, but I started using 0.8.0 today and have experienced a very similar issue in a different project.

The main project targets netcoreapp2.1. Multiple DLLs referenced by the main project were in use, preventing the build from finishing. Closing the tab with the designer did fix it this time (it was open in the backgroud - I was editing a C# file at the time).

I'll update as I have more experience with the newer version.

OronDF343 avatar Apr 09 '19 14:04 OronDF343

Thanks. When you do a build do you get get yellow banner at the top of the designer saying "the designer is paused because a build is in progress?"

grokys avatar Apr 09 '19 16:04 grokys

Yes, only when the designer is visible. If it is in a background tab I don't see that, and am more likely to get the issue.

On Tue, Apr 9, 2019 at 7:41 PM Steven Kirk [email protected] wrote:

Thanks. When you do a build do you get get yellow banner at the top of the designer saying "the designer is paused because a build is in progress?"

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AvaloniaUI/AvaloniaVS/issues/54#issuecomment-481329348, or mute the thread https://github.com/notifications/unsubscribe-auth/AE5SjJBYfW2xm1k1k0ILP0j6few2eF7eks5vfMLXgaJpZM4QP0cn .

OronDF343 avatar Apr 09 '19 16:04 OronDF343

Ok, could you look in the VS output window and show output from "Avalonia Diagnostics". You should see something like this appear when you start a build:

18:50:41.680 [Debug]  Build started
18:50:41.683 [Debug]  Setting pause state to True
18:50:41.686 [Verbose] 26144 Started PreviewerProcess.Stop()
18:50:41.688 [Information] 26144 Stopping previewer process
18:50:41.749 [Debug] 26144 Killing previewer process
18:50:41.752 [Information]  Process exited
18:50:41.756 [Verbose]  Started PreviewerProcess.Stop()
18:50:41.758 [Information]  Stopping previewer process
18:50:41.762 [Verbose]  Finished PreviewerProcess.Stop()
18:50:41.752 [Verbose]  Finished PreviewerProcess.Stop()
18:50:43.693 [Debug]  Build finished
18:50:43.695 [Debug]  Setting pause state to False
18:50:43.698 [Verbose]  Started AvaloniaDesigner.LoadTargetsAndStartProcessAsync()

Could you check if that is happening for you?

grokys avatar Apr 09 '19 16:04 grokys

I've seen this a few times recently but can't work out why it's happening. The previewer process appears to be stopped. Need to investigate more...

grokys avatar Apr 18 '19 18:04 grokys

I'm experiencing it now with vs 2022 (17.5.4), here is the output from "Avalonia Diagnostics":

20:41:10.433 [Information]  Avalonia Package initialized
20:41:36.337 [Information] 0 Starting previewer process for '"...\Avalonia_1.app\bin\Debug\net7.0-windows\Avalonia_1.app.dll"'
20:41:36.416 [Information] 7700 Started previewer process for '"...\Avalonia_1.app\bin\Debug\net7.0-windows\Avalonia_1.app.dll"'. Waiting for connection to be initialized.
20:41:36.536 [Information] 7700 Connection initialized

nothing happening on build as you can see

arknest avatar Apr 13 '23 18:04 arknest

@donandren I'm getting the same issue on the latest visual studio. It's really annoying...

Edit: I noticed it was happening when using ReSharper Build and not happening when using MS Build.

image

RaoHammas avatar Sep 29 '23 15:09 RaoHammas