Avalonia icon indicating copy to clipboard operation
Avalonia copied to clipboard

Random VS/Mac compile failures for sharing violation

Open FloridaMatt opened this issue 4 years ago • 8 comments

MacOS Big Sur 11.1 Visual Studio for Mac 8.8.5 (build 18) Avalonia 0.9.12

About a quarter of the time after correcting a syntax error that caused a build failure, the next build attempt fails with the following message:

/Users/t/.nuget/packages/avalonia/0.9.12/build/AvaloniaBuildTasks.targets(5,5): Error MSB4018: The "CompileAvaloniaXamlTask" task failed unexpectedly. System.IO.IOException: Sharing violation on path /Users/t/Projects/PhotoViewer/obj/Debug/netcoreapp5.0/osx-x64/Avalonia/original.pdb at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x00259] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:274 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:106 at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions) at System.IO.FileSystem.CopyFile (System.String sourceFullPath, System.String destFullPath, System.Boolean overwrite) [0x00035] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/FileSystem.Unix.cs:55 at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00056] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/File.cs:74 at Avalonia.Build.Tasks.CompileAvaloniaXamlTask.Execute () [0x00074] in D:\a\1\s\src\Avalonia.Build.Tasks\CompileAvaloniaXamlTask.cs:29 at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono-pullrequest/pr/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:577 at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002b9] in /Users/builder/jenkins/workspace/build-package-osx-mono-pullrequest/pr/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:809 (MSB4018) (PhotoViewer)

The only workaround I know of is to close and reopen the project, after which it compiles successfully (if there are no other errors),

FloridaMatt avatar Jan 14 '21 19:01 FloridaMatt

Try running lsof to determine which process is holding the file.

kekekeks avatar Jan 14 '21 20:01 kekekeks

I was able to reproduce the issue when compiling with the /maxCpuCount flag set on Windows as well

trympet avatar Jun 01 '21 21:06 trympet

I've seen this too, lsof's reporting mono-sgen holds the file lock

CBesser avatar Sep 03 '21 12:09 CBesser

I'm also seeing this happen. MacOS: 10.15.7 Visual Studio for Mac: 8.10.11 (build 8) Dotnet version: 5.0.402

It does not happen if I build with either "dotnet build" at the command line or if I build with Visual Studio Code. (I think these two are equivalent.)

So there's something different about the way VS/Mac builds vs. VSCode/Command Line.

mrj001 avatar Oct 18 '21 14:10 mrj001

I'm also seeing this on Linux 5.16.14-1-MANJARO dotnet 6.0.201 Just create a new Avalonia cross-platform project by dotnet new avalonia.xplat and run dotnet run in the Android project will get this error, but dotnet build seems to be fine

Tlaster avatar Apr 11 '22 04:04 Tlaster

still getting this error on arch linux 5.19.4 rider /vs code /cli dotnet 6.0.400

im getting this error even on a completely new project anyone found a soultion?

deepxnside avatar Aug 27 '22 15:08 deepxnside

I had a similar error when debug for Android. Host: Win10 Avalonia: 11.0.0-rc1.1 ReactiveUI.Fody: 19.2.1 Rider + .NET 7.0

I was able to fix this error by disabling parallel build (maxCpuCount=1).

image image

I think it happen when using ReactiveUI.Fody packet: it generate for PropertyChanges code for marked [Reactive] attributes properties when build is runing.

asvol avatar Jun 30 '23 19:06 asvol

Now that we have the CommunityToolkit.MVVM package, the [Reactive] attribute can be replaced by [ObservableProperty] which is a source generator and thus seems to perform better in most cases.

timunie avatar Jul 03 '23 11:07 timunie

If you use library classes and not using any UI/XAML, the problem could be solved by disabling the compilation of XAML: <EnableAvaloniaXamlCompilation>false</EnableAvaloniaXamlCompilation>

Snegovikufa avatar Jul 20 '23 11:07 Snegovikufa

Disabling "Use ReSharper Build" does fix it on Ubuntu 22.04 / JB Rider / .NET 7.0

GaspHard avatar Aug 27 '23 13:08 GaspHard

I'm getting this on MacOS / Rider / .Net 7 / Android emulator

Simply disabling "Use ReSharper Build" and debug running again did not fix it.

Alternating between Build "Use up to [ 14 ] processes in parallel" VS [ 1 ] does show that 14 triggers the problem

I suppose that would make the build way slower.

It happens at least 50% of the time when I first try to run the app in debug mode. If I then try again to run it succeeds every time I think.

It's very annoying because the debug build cycle is very important for productivity.

  AvaloniaBuildTasks.targets(120, 5): [MSB4018] The "CompileAvaloniaXamlTask" task failed unexpectedly.
System.IO.IOException: The process cannot access the file '/Users/gary/repos/civmec/CivtracSupervisor/AvaloniaInsideShell/src/AvaloniaInside.Shell/obj/Debug/net7.0/Avalonia/original.pdb' because it is being used by another process.
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Init(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Int64& fileLength, UnixFileMode& filePermissions)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Func`4 createOpenException)
   at System.IO.FileSystem.CopyFile(String sourceFullPath, String destFullPath, Boolean overwrite)
   at Avalonia.Build.Tasks.CompileAvaloniaXamlTask.Execute() in /_/src/Avalonia.Build.Tasks/CompileAvaloniaXamlTask.cs:line 35
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)

buzzware avatar Oct 26 '23 04:10 buzzware

Hi!

We have faced with this issue too. To be honest every 3rd compilation pipeline fails on our compilation servers so the working process has stopped with endless reruns. We are in fire with this bug...

C:\Users\<user>\.nuget\packages\avalonia\11.0.4\buildTransitive\AvaloniaBuildTasks.targets(120,5): error MSB4018: непредвиденная ошибка при выполнении задачи "CompileAvaloniaXamlTask".
System.IO.IOException: Процесс не может получить доступ к файлу "obj\.sual\Debug\net7.0\Avalonia\original.pdb", так как этот файл используется другим процессом.
   в System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   в System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
   в Avalonia.Build.Tasks.CompileAvaloniaXamlTask.Execute() в /_/src/Avalonia.Build.Tasks/CompileAvaloniaXamlTask.cs:строка 36
   в Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   в Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() [<here is the path to failed csproj>]

lsoft avatar Oct 27 '23 17:10 lsoft

We can easily reproduce it with the following powershell script

Set-Location 'folder of sln file';

$Iteration = 0;
while(1)
{
    [System.Console]::WriteLine('Iteration: ' + $Iteration + ', Now: ' + [System.DateTime]::Now);

    $MsBuildProcess = Start-Process -WindowStyle Hidden -Wait -PassThru -FilePath 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\MSBuild.exe' -ArgumentList ( ' your.sln -bl:your.binlog' );
    if($MsBuildProcess.ExitCode -ne 0)
    {
        [System.Console]::WriteLine('msbuild fail!');
        exit $MsBuildProcess.ExitCode;
    }

    $Iteration += 1;
}

wait for this script will finish with msbuild fail and take a look inside your.binlog (by using an appropriate utility).

lsoft avatar Oct 27 '23 17:10 lsoft

As I can understand, we see some kind of race condition at the line https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Build.Tasks/CompileAvaloniaXamlTask.cs#L35

where OriginalCopyPath is $(IntermediateOutputPath)/Avalonia/original.dll and that file is being used by another process. what is the process which locked that file?!.. it is a hard problem for avalonia-newbie... @kekekeks, ask you as assignee, any ideas, tips?

lsoft avatar Oct 28 '23 12:10 lsoft

@kekekeks @maxkatz6 or other maintainers: here is almost 100% repro , the root cause is the multilply root projects, all of them is referencing (via others csprojes) to BBBBBB project, and BBBBBB project fails with

C:\Users\<username>\.nuget\packages\avalonia\11.0.4\buildTransitive\AvaloniaBuildTasks.targets(120,5): error MSB4018: непредвиденная ошибка при выполнении задачи "CompileAvaloniaXamlTask".
System.IO.IOException: Процесс не может получить доступ к файлу "obj\Debug\net7.0\Avalonia\original.pdb", так как этот файл используется другим процессом.
   в System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   в System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
   в Avalonia.Build.Tasks.CompileAvaloniaXamlTask.Execute() в /_/src/Avalonia.Build.Tasks/CompileAvaloniaXamlTask.cs:строка 36
   в Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   в Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() [master_A2Z\src\A2Z\BBBBBB\BBBBBB.csproj]

master_A2Z.zip

Interestingly, compilation inside VS is completely fine, so one needs to compile from command line to see the bug. Here is repro powershell script:

Set-Location 'path to master_A2Z folder';

$RestoreProcess = Start-Process -WindowStyle Hidden -PassThru -FilePath 'dotnet' -ArgumentList ( ' restore A2Z.sln ' );
Wait-Process -InputObject $RestoreProcess;

$Iteration = 0;
while(1)
{
    [System.Console]::WriteLine('Iteration: ' + $Iteration + ', Now: ' + [System.DateTime]::Now);

    # probably you will need to change this msbuild path
    $MsBuildProcess = Start-Process -WindowStyle Hidden -PassThru -FilePath 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\MSBuild.exe' -ArgumentList ( ' A2Z.sln /v:quiet /bl:mk.binlog /maxcpucount:1 /p:BuildInParallel=false' );
    Wait-Process -InputObject $MsBuildProcess;
    if($MsBuildProcess.ExitCode -ne 0)
    {
        [System.Console]::WriteLine('msbuild fail!');
        exit $MsBuildProcess.ExitCode;
    }

    $Iteration += 1;
}

running this, I see the following:

PS C:\temp> .\msbuild_mk.ps1
Iteration: 0, Now: 10/29/2023 12:33:42
msbuild fail!

or rarely this:

PS C:\temp> .\msbuild_mk.ps1
Iteration: 0, Now: 10/29/2023 12:26:08
Iteration: 1, Now: 10/29/2023 12:32:07
msbuild fail!

looking at MSBuild Structured Log Viewer I see this error.

here is Process Monitor log

13:01:18,3088972	MSBuild.exe	142976	IRP_MJ_CREATE	C:\<here is the path>\master_A2Z\src\A2Z\BBBBBB\obj\Debug\net7.0\Avalonia\original.pdb	SHARING VIOLATION	Desired Access: Generic Read/Write, Delete, Write DAC, Disposition: OverwriteIf, Options: Sequential Access, Synchronous IO Non-Alert, Non-Directory File, Attributes: A, ShareMode: None, AllocationSize: 10 676
13:01:18,3092621	MSBuild.exe	142976	IRP_MJ_CREATE	C:\<here is the path>\master_A2Z\src\A2Z\BBBBBB\obj\Debug\net7.0\Avalonia\original.pdb	SHARING VIOLATION	Desired Access: Generic Write, Read Data/List Directory, Read Attributes, Delete, Write DAC, Disposition: OverwriteIf, Options: Sequential Access, Synchronous IO Non-Alert, Non-Directory File, Attributes: A, ShareMode: None, AllocationSize: 10 676
13:01:18,3096137	MSBuild.exe	142976	IRP_MJ_CREATE	C:\<here is the path>\master_A2Z\src\A2Z\BBBBBB\obj\Debug\net7.0\Avalonia\original.pdb	SHARING VIOLATION	Desired Access: Generic Write, Read Attributes, Delete, Write DAC, Disposition: OverwriteIf, Options: Sequential Access, Synchronous IO Non-Alert, Non-Directory File, Attributes: A, ShareMode: None, AllocationSize: 10 676
13:01:18,3099288	MSBuild.exe	142976	IRP_MJ_CREATE	C:\<here is the path>\master_A2Z\src\A2Z\BBBBBB\obj\Debug\net7.0\Avalonia\original.pdb	SHARING VIOLATION	Desired Access: Generic Write, Read Data/List Directory, Read Attributes, Delete, Write DAC, Disposition: OverwriteIf, Options: Sequential Access, Synchronous IO Non-Alert, Non-Directory File, Attributes: A, ShareMode: Read, Write, AllocationSize: 10 676
13:01:18,3102536	MSBuild.exe	142976	IRP_MJ_CREATE	C:\<here is the path>\master_A2Z\src\A2Z\BBBBBB\obj\Debug\net7.0\Avalonia\original.pdb	SHARING VIOLATION	Desired Access: Generic Write, Read Data/List Directory, Read Attributes, Delete, Write DAC, Disposition: OverwriteIf, Options: Sequential Access, Synchronous IO Non-Alert, Non-Directory File, Attributes: A, ShareMode: Read, Write, AllocationSize: 10 676
13:01:18,3105866	MSBuild.exe	142976	IRP_MJ_CREATE	C:\<here is the path>\master_A2Z\src\A2Z\BBBBBB\obj\Debug\net7.0\Avalonia\original.pdb	SHARING VIOLATION	Desired Access: Generic Write, Read Attributes, Delete, Write DAC, Disposition: OverwriteIf, Options: Sequential Access, Synchronous IO Non-Alert, Non-Directory File, Attributes: A, ShareMode: Read, Write, AllocationSize: 10 676
13:01:18,3109093	MSBuild.exe	142976	IRP_MJ_CREATE	C:\<here is the path>\master_A2Z\src\A2Z\BBBBBB\obj\Debug\net7.0\Avalonia\original.pdb	SHARING VIOLATION	Desired Access: Generic Write, Read Data/List Directory, Read Attributes, Write DAC, Disposition: OverwriteIf, Options: Sequential Access, Synchronous IO Non-Alert, Non-Directory File, Attributes: A, ShareMode: Read, Write, AllocationSize: 10 676
13:01:18,3113714	MSBuild.exe	142976	IRP_MJ_CREATE	C:\<here is the path>\master_A2Z\src\A2Z\BBBBBB\obj\Debug\net7.0\Avalonia\original.pdb	SHARING VIOLATION	Desired Access: Generic Write, Read Data/List Directory, Read Attributes, Write DAC, Disposition: OverwriteIf, Options: Sequential Access, Synchronous IO Non-Alert, Non-Directory File, Attributes: A, ShareMode: Read, Write, AllocationSize: 10 676
13:01:18,3118344	MSBuild.exe	142976	IRP_MJ_CREATE	C:\<here is the path>\master_A2Z\src\A2Z\BBBBBB\obj\Debug\net7.0\Avalonia\original.pdb	SHARING VIOLATION	Desired Access: Generic Write, Read Attributes, Write DAC, Disposition: OverwriteIf, Options: Sequential Access, Synchronous IO Non-Alert, Non-Directory File, Attributes: A, ShareMode: Read, Write, AllocationSize: 10 676
13:01:23,1389123	MSBuild.exe	142976	IRP_MJ_CLEANUP	C:\<here is the path>\master_A2Z\src\A2Z\BBBBBB\obj\Debug\net7.0\Avalonia\original.pdb	SUCCESS	
13:01:23,1389723	MSBuild.exe	142976	IRP_MJ_CLOSE	C:\<here is the path>\master_A2Z\src\A2Z\BBBBBB\obj\Debug\net7.0\Avalonia\original.pdb	SUCCESS	
13:01:23,4386530	System	4	FASTIO_ACQUIRE_FOR_SECTION_SYNCHRONIZATION	C:\<here is the path>\master_A2Z\src\A2Z\BBBBBB\obj\Debug\net7.0\Avalonia\original.pdb	SUCCESS	SyncType: SyncTypeOther
13:01:23,4387064	System	4	IRP_MJ_CLOSE	C:\<here is the path>\master_A2Z\src\A2Z\BBBBBB\obj\Debug\net7.0\Avalonia\original.pdb	SUCCESS	

if I read this correctly, MSBuild conflicts with itself (PTAL on /maxcpucount:1 /p:BuildInParallel=false in powershell script).

I hope any maintainer will take a look here, because this is very difficult problem for those who faced it. We are going to perform autorerun if building fails and original.pdb contains in build log, but our compilation cluster will degrade severely because of this.

Please let me know if you will need any info\support.

lsoft avatar Oct 29 '23 08:10 lsoft

Please let us know if this issue is solved in the latest master (or future releases). This issue isn't reproducible on our machines, and we only can guess that it could be due to different GC releasing file handles at different times (VS Mac/Resharper Mono GC vs CoreCLR GC). Recent PR should make releasing file handles a solved issue.

maxkatz6 avatar Oct 31 '23 01:10 maxkatz6

@maxkatz6 I switch my repro sln to the version 11.1.999-cibuild0041387-beta and see the following log

PS C:\temp> .\msbuild_mk.ps1
Iteration: 0, Now: 10/31/2023 08:53:59
Iteration: 1, Now: 10/31/2023 08:54:37
Iteration: 2, Now: 10/31/2023 08:55:00
Iteration: 3, Now: 10/31/2023 08:55:27
Iteration: 4, Now: 10/31/2023 08:55:53
Iteration: 5, Now: 10/31/2023 08:56:15
Iteration: 6, Now: 10/31/2023 08:56:38
Iteration: 7, Now: 10/31/2023 08:57:01
Iteration: 8, Now: 10/31/2023 08:57:29
Iteration: 9, Now: 10/31/2023 08:57:53
Iteration: 10, Now: 10/31/2023 08:58:19
Iteration: 11, Now: 10/31/2023 08:58:43
Iteration: 12, Now: 10/31/2023 08:59:07
Iteration: 13, Now: 10/31/2023 08:59:32
Iteration: 14, Now: 10/31/2023 08:59:56
Iteration: 15, Now: 10/31/2023 09:00:16
Iteration: 16, Now: 10/31/2023 09:00:37
Iteration: 17, Now: 10/31/2023 09:00:59
Iteration: 18, Now: 10/31/2023 09:01:26
Iteration: 19, Now: 10/31/2023 09:01:49

then I swith it to 11.0.5 back and see this:

PS C:\temp> .\msbuild_mk.ps1
Iteration: 0, Now: 10/31/2023 09:03:45
msbuild fail!

so I guess issue is resolved. I will let you know if anything will go wrong again.

@kekekeks @maxkatz6 thank you guys for rapid reaction. we saved from a lot of pain... is there any plan to release 11.0.6 or something like it? this will allow us to switch away from nightly feed...

ps. perhaps you want to close a related issue https://github.com/AvaloniaUI/Avalonia/issues/12670

lsoft avatar Oct 31 '23 04:10 lsoft

@maxkatz6 @kekekeks the bug has returned.

image

I decompiled (dotpeek) the file C:\Users\<user>\.nuget\packages\avalonia\11.1.999-cibuild0041411-beta\tools\netstandard2.0 and recent fix is in place:

image

Please reopen this issue. We need your help again :(

could I do anything to help the investigation?

lsoft avatar Nov 01 '23 18:11 lsoft

I want to add one more point. Something has changed after @kekekeks using fix.

My message above is from repo I shared earlier. But in our commercial system I see sometimes only

C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4702,5): error MSB3030: не удалось скопировать файл "obj\Release\net7.0\my.dll" - файл не найден. [E:\glr\builds\kryMeSns\0\...\Mobile\Avalonia\....\our avalonia using.csproj]

with no original.pdb at all in msbuild binlog.

Looks like there is additional issue.

lsoft avatar Nov 02 '23 05:11 lsoft

@maxkatz6 @kekekeks looks like I found what is wrong now.

I get master_A2Z.zip repro, run dotnet restore and run the following script:

Set-Location 'folder path for master_A2Z';

$Iteration = 0;
while(1)
{
    [System.Console]::WriteLine('Iteration: ' + $Iteration + ', Now: ' + [System.DateTime]::Now);

    #$MsBuildProcess = Start-Process -WindowStyle Hidden -PassThru -FilePath 'dotnet' -ArgumentList ( ' build -m:1 /nr:false -clp:"ErrorsOnly;Summary" /p:Platform="Any CPU";Configuration="Release";Optimize="true";DebugSymbols="true";DebugType="full";BuildInParallel=false /bl:avalonia.binlog' );
    $MsBuildProcess = Start-Process -WindowStyle Hidden -PassThru -FilePath 'dotnet' -ArgumentList ( ' build -m /nr:false -clp:"ErrorsOnly;Summary" /p:Platform="Any CPU";Configuration="Release";Optimize="true";DebugSymbols="true";DebugType="full" /bl:avalonia.binlog' );
    Wait-Process -InputObject $MsBuildProcess;
    if($MsBuildProcess.ExitCode -ne 0)
    {
        [System.Console]::WriteLine('msbuild fail!');
        exit $MsBuildProcess.ExitCode;
    }

    $Iteration += 1;
}

and I see the error. then I comment $MsBuildProcess = Start-Process line, and UNcomment #$MsBuildProcess = Start-Process line, and rerun the script. Everything was OK for 20 iterations. Then I stopped the script and return that wrong line back and see the error again:

image

the difference between lines is -m <-> -m:1 BuildInParallel=false !

So, things look like that @kekekeks's PR fixed the bug in sequential compilation (which totally makes sense!), but something wrong is still here for parallel compilation!

Hope this helps you to resolve. At least, we have viable workaround now.

We are keep eye on this bug. Sorry for bothering :)

lsoft avatar Nov 02 '23 07:11 lsoft

@kekekeks @maxkatz6 thank you guys for rapid reaction. we saved from a lot of pain... is there any plan to release 11.0.6 or something like it? this will allow us to switch away from nightly feed...

Yes indeed - this issue is making life hard, and its been over 4 weeks since 11.0.5.

buzzware avatar Nov 24 '23 07:11 buzzware

What is the best version of Avalonia right now - 11.0.5 or which nightly?

buzzware avatar Nov 24 '23 07:11 buzzware

@buzzware as the issue is still open I'm not sure it is fixed in nightly, If it is fixed there, I'd go with nightly tbh.

Moreover we have the label help-wanted. So if anyone has an idea and the needed machine to test, please file a PR.

timunie avatar Nov 24 '23 08:11 timunie

@buzzware

11.0.5 or which nightly?

we are using some nightly revision. everything looks good, but we are waiting for 11.0.6 to have additional safety....

@timunie

if anyone has an idea and the needed machine to test, please file a PR

let me ask: I had shared the repro above. did Avalonia team check that repro? the repro has failed for me with almost 100% probability. Let me know if you have any troubles with that repro, because I'm highly motivated to see this issue resolved.

lsoft avatar Nov 24 '23 09:11 lsoft

I only have windows, so I cannot check on my ends. But if the sample works in nightly, the issue is resolved.

[!NOTE] If the potential fix will be backported to 11.0.6 I cannot say. But latest 11.1.0 should have it in.

timunie avatar Nov 24 '23 09:11 timunie

@timunie

I only have windows

I have windows too, and my repro (which includes powershell script) is for windows too. Noone confirm or rejected that the repro (https://github.com/AvaloniaUI/Avalonia/issues/5294#issuecomment-1790239889) has failed or works fine. This is sad... I don't know how to help this further. Noone guide me...

lsoft avatar Nov 24 '23 09:11 lsoft

I'm on an Intel Mac with Ventura. This happens regularly on 11.0.5. My solution used mixed latest nightly and 11.0.5. If I built the solution, it would fail on a project on 11.0.5. I just made all projects use 11.1.999-cibuild0041387-beta as @lsoft describes above, and the problem went away.

buzzware avatar Nov 24 '23 10:11 buzzware

acc. to feedback this issue seems to be resolved in nightly. So I'm closing it. If someone has this happen on (upcomming) 11.1 or nightly, please ping me and I'll re-open the issue.

timunie avatar Nov 24 '23 13:11 timunie

@timunie sorry to bother, but I don't follow.... this issue had been closed and then reopened again because nightly builds fix the problem only with -m:1 build key, which means sequentially building.

I had reported this in https://github.com/AvaloniaUI/Avalonia/issues/5294#issuecomment-1790239889

did I lost something important? parallel build is fixed now too? I can confirm we are experiencing troubles without -m:1 key (in parallel building).

lsoft avatar Nov 24 '23 16:11 lsoft

@lsoft can you reproduce the issue with a Nuget package built from #13840?

TomEdwardsEnscape avatar Dec 06 '23 07:12 TomEdwardsEnscape