elringus / bootsharp

Compile C# solution into single-file ES module with auto-generated JavaScript bindings and type definitions
https://bootsharp.com
MIT License
662 stars 36 forks source link

Does this work on MacOS? #85

Closed promontis closed 2 years ago

promontis commented 2 years ago

When I do dotnet publish for the Hello World sample on Window, everything works, and the UMD library is published. When I run it on a Mac, I get error CS8795: Partial method 'Program.GetHostName()' must have an implementation part because it has accessibility modifiers.

elringus commented 2 years ago

I don't have access to Mac to test this, unfortunately. Is this "GetHostName" is the partial method from the readme example? In this case, it probably has something to do with code generation not working correctly.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 14 days with no activity. It will be automatically closed in 7 days.

promontis commented 1 year ago

@Elringus The problem was indeed with source generation.

The problem was that I required a newer .NET 6 SDK. From the OmniSharp output I was using the 6.0.2xx SDKs which align with VS 17.1. The source generator is trying to load Roslyn 4.2 dependencies which align with VS 17.2.

elringus commented 1 year ago

Could it be related with Microsoft.CodeAnalysis? I've recently noticed that latest v4.3 is not working correctly and had to downgrade back to 4.2. Not sure if they've changed something or that's a bug.

promontis commented 1 year ago

The error was something like "An instance of analyzer Generator.SourceGenerator cannot be created" and it indeed was referring to the Microsoft.CodeAnalysis dll. Yesterday I installed .NET 7 SDK and I saw Omnisharp has picked that up as the running SDK. It probably works with SDK 6.0.300 and up. If you switch to 4.3, that minimum SDK version will probably also increase.

See also https://github.com/Elringus/DotNetJS/pull/92 were I added a couple of FAQ lines, so that other people might also discover this sooner :)