Visual Studio Designer fail to render when Platform target is x86
See original GitHub issueHello team,
I’ve created the “Avalonia MVVM Application” template project from visual studio. And I’ve updated Avalonia packages to v0.10.0-rc1. Then I set the project platform target to x86. The designer renders correctly for about 1 ~ 2 seconds then shows “Process Exited” without properly render.
If I switch platform target back to Any CPU, then everything works fine. Is this a bug?
Steps to reproduce the behavior:
- Create MVVM template using visual studio
- Update all packages to v0.10.0-rc1
- Set project platform target to x86
- See MainWindow.axaml
Visual Studio Version: Microsoft Visual Studio Professional 2019 Version 16.8.3 OS: Windows 10 Enterprise Runtime: netcoreapp3.1
Below are the error output from Avalonia Diagnostics
15:47:18.603 [Debug] Build started
15:47:18.608 [Debug] Build started
15:47:18.608 [Debug] Setting pause state to True
15:47:18.608 [Verbose] Started PreviewerProcess.Stop()
15:47:18.608 [Information] Stopping previewer process
15:47:18.608 [Verbose] Finished PreviewerProcess.Stop()
15:47:19.555 [Debug] Build finished
15:47:19.557 [Debug] Build finished
15:47:19.557 [Debug] Setting pause state to False
15:47:19.557 [Verbose] Started AvaloniaDesigner.StartProcessAsync()
15:47:19.557 [Verbose] Started AvaloniaDesigner.CreateCompletionMetadataAsync() for "C:\Users\alanyu\source\repos\avax86\AvaloniaApplication\AvaloniaApplication\bin\Debug\netcoreapp3.1\AvaloniaApplication.dll"
15:47:19.557 [Verbose] Started PreviewerProcess.StartAsync()
15:47:19.558 [Information] Starting previewer process for '"C:\Users\alanyu\source\repos\avax86\AvaloniaApplication\AvaloniaApplication\bin\Debug\netcoreapp3.1\AvaloniaApplication.dll"'
15:47:19.558 [Debug] > dotnet.exe "exec --runtimeconfig \"C:\Users\alanyu\source\repos\avax86\AvaloniaApplication\AvaloniaApplication\bin\Debug\netcoreapp3.1\AvaloniaApplication.runtimeconfig.json\" --depsfile \"C:\Users\alanyu\source\repos\avax86\AvaloniaApplication\AvaloniaApplication\bin\Debug\netcoreapp3.1\AvaloniaApplication.deps.json\" \"C:\Users\alanyu\.nuget\packages\avalonia\0.10.0-rc1\build\\..\tools\netcoreapp2.0\designer\Avalonia.Designer.HostApp.dll\" --transport tcp-bson://127.0.0.1:57580/ \"C:\Users\alanyu\source\repos\avax86\AvaloniaApplication\AvaloniaApplication\bin\Debug\netcoreapp3.1\AvaloniaApplication.dll\""
15:47:20.062 [Information] 11168 Started previewer process for '"C:\Users\alanyu\source\repos\avax86\AvaloniaApplication\AvaloniaApplication\bin\Debug\netcoreapp3.1\AvaloniaApplication.dll"'. Waiting for connection to be initialized.
15:47:20.672 [Error] 11168 <= "Unhandled exception. System.IO.FileLoadException: Could not load file or assembly 'Avalonia.Base, Version=0.10.0.0, Culture=neutral, PublicKeyToken=c8d484a7012f9a8b'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)"
15:47:20.685 [Error] 11168 <= "File name: 'Avalonia.Base, Version=0.10.0.0, Culture=neutral, PublicKeyToken=c8d484a7012f9a8b'"
15:47:20.686 [Error] 11168 <= " at Avalonia.Designer.HostApp.Program.Main(String[] args)"
15:47:21.349 [Verbose] Finished AvaloniaDesigner.CreateCompletionMetadataAsync() took 00:00:01.7920818 for "C:\Users\alanyu\source\repos\avax86\AvaloniaApplication\AvaloniaApplication\bin\Debug\netcoreapp3.1\AvaloniaApplication.dll"
15:47:21.349 [Verbose] Finished AvaloniaDesigner.CreateCompletionMetadataAsync()
15:47:22.196 [Information] Process exited while waiting for connection to be initialized.
15:47:22.199 [Debug] Process.StartAsync exited with error
System.ApplicationException: The previewer process exited unexpectedly with code -532462766.
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at AvaloniaVS.Services.PreviewerProcess.<StartAsync>d__30.MoveNext() in D:\a\1\s\AvaloniaVS\Services\PreviewerProcess.cs:line 232
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at AvaloniaVS.Views.AvaloniaDesigner.<StartProcessAsync>d__55.MoveNext() in D:\a\1\s\AvaloniaVS\Views\AvaloniaDesigner.xaml.cs:line 441
15:47:22.199 [Verbose] Finished AvaloniaDesigner.StartProcessAsync()
15:47:22.197 [Information] Process exited
15:47:22.199 [Verbose] Started PreviewerProcess.Stop()
15:47:22.199 [Information] Stopping previewer process
15:47:22.200 [Verbose] Finished PreviewerProcess.Stop()
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Visual Studio C# target platform x86 but nuget package ...
I have to build x86 program. I use package from nuget (ENet-CSharp). My program is bult succesfully but when I run it I...
Read more >32-bit COM Assembly Doesn't Work With x86/AnyCPU ...
I have a web app which has list of projects, all under single solution. Many of them refers the COM DLLs which is...
Read more >How to use assemblies built for a specific platform (x86 or ...
This behavior occurs because Visual Studio 2022 is a 64-bit application, and it must load all referenced assemblies at design time. On Windows, ......
Read more >Troubleshoot .NET Framework targeting errors
To resolve the error, make sure that your application targets a .NET version that's compatible with the version that's targeted by the ...
Read more >Cannot debug net6.0-macos Apps - Developer Community
This is a regression. I can no longer debug net6.0-macos apps. It also fails for net6.0-maccatalyst apps. When I hit debug, the following ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Found some clue after 2 days work. The avalonia dll Avalonia.DesignerSupport.dll we got from nuget is targeted for AnyCpu, according to my test, only x86 targeted application can load my x86 assembly(myapp.dll) using Assembly.LoadFile(), when previewer routine Avalonia.DesignerSupport.dll try to load the dll, System.IO.FileLoadException raised.
Same situation here, worked for about 2 days, have no solution.