chromelyapps / Chromely

Build Cross Platform HTML Desktop Apps on .NET using native GUI, HTML5, JavaScript, CSS, Owin, AspNetCore (MVC, RazorPages, Blazor)
MIT License
2.99k stars 279 forks source link

COM Interop is not supported on this platform. #383

Closed brandochn closed 1 year ago

brandochn commented 1 year ago

Hi Guys,

I have downloaded the latest source code of demo-projects and I adjusted the Chromely.CrossPlat project to work on Linux platform and I got the following error:

$ dotnet run --project Chromely.CrossPlat
Unhandled exception. System.PlatformNotSupportedException: COM Interop is not supported on this platform.
   at System.Threading.Thread.SetApartmentStateUnchecked(ApartmentState state, Boolean throwOnError)
   at System.Threading.Thread.SetApartmentState(ApartmentState state, Boolean throwOnError)
   at System.Threading.Thread.SetApartmentState(ApartmentState state)
   at Chromely.NativeHosts.ThreadApt.STA()
   at Program.<Main>$(String[] args) in /Chromely/demo-projects/regular-chromely/Chromely.CrossPlat/Program.cs:line 10

imagen

imagen

I ran this into OS: Fedora 36 x64. .Net: 6.0.107

seerkong commented 1 year ago

Hi Guys,

I have downloaded the latest source code of demo-projects and I adjusted the Chromely.CrossPlat project to work on Linux platform and I got the following error:

$ dotnet run --project Chromely.CrossPlat
Unhandled exception. System.PlatformNotSupportedException: COM Interop is not supported on this platform.
   at System.Threading.Thread.SetApartmentStateUnchecked(ApartmentState state, Boolean throwOnError)
   at System.Threading.Thread.SetApartmentState(ApartmentState state, Boolean throwOnError)
   at System.Threading.Thread.SetApartmentState(ApartmentState state)
   at Chromely.NativeHosts.ThreadApt.STA()
   at Program.<Main>$(String[] args) in /Chromely/demo-projects/regular-chromely/Chromely.CrossPlat/Program.cs:line 10

imagen

imagen

I ran this into OS: Fedora 36 x64. .Net: 6.0.107

you can try comment the line : ThreadApt.STA(). It works on my mac

brandochn commented 1 year ago

@seerkong I commented the line: ThreadApt.STA(); and the Chromely.CrossPlat project is working well now.

Thank you.