Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for webassembly #201

Closed
wieslawsoltes opened this issue Feb 2, 2022 · 5 comments
Closed

Add support for webassembly #201

wieslawsoltes opened this issue Feb 2, 2022 · 5 comments

Comments

@wieslawsoltes
Copy link
Contributor

When trying to run on webassembly I get the following exception:

Unhandled exception rendering component: Operation is not supported on this platform.
System.PlatformNotSupportedException: Operation is not supported on this platform.
   at System.Threading.Thread.Start()
   at TextMateSharp.Model.TMModel.TokenizerThread.Run() in /_/src/TextMateSharp/Model/TMModel.cs:line 63
   at TextMateSharp.Model.TMModel.Start() in /_/src/TextMateSharp/Model/TMModel.cs:line 334
   at TextMateSharp.Model.TMModel.SetGrammar(IGrammar grammar) in /_/src/TextMateSharp/Model/TMModel.cs:line 282
   at AvaloniaEdit.TextMate.TextMateColoringTransformer.SetGrammar(IGrammar grammar)
   at AvaloniaEdit.TextMate.TextMate.Installation.SetGrammar(String scopeName)
@Numpsy
Copy link

Numpsy commented Mar 29, 2023

I haven't tried to get syntax highlighting going in web assembly with the latest Avalonia 11 previews, but fwiw I've tried the build from #318 with 11p6 and both folding and searching are working fine.

One small comment about the searching though - the search panel opens up immediately when pressing ctrl+f, but there is a noticable lag between starting to type into the search box and anything happening with the search as compared to desktop app usage. (I haven't made an attempt at working out what's taking the time)

@Gillibald
Copy link
Contributor

Keep in mind wasm does not support threading at the moment so you will not get any background processing

@Numpsy
Copy link

Numpsy commented Mar 30, 2023

I at one point had a go a building eveything with WasmEnableThreads but couldn't get it working at the time, I keep meaning to have another go and haven't got to it yet :-(

@danipen
Copy link
Collaborator

danipen commented Mar 30, 2023

Does .net7 support threads by default in wasm? or not yet?

@Numpsy
Copy link

Numpsy commented Mar 30, 2023

If you enable that msbuild setting then it sets up some machinery to use web workers for running additional 'threads'.

The first problem with this with Avalonia is that you need WASM builds of SkiaSharp and HarfBuzz that have been built with some extra threading options, and it looks like that's still only available in the preview builds. (mono/SkiaSharp#2285)

I just gave it a go with a build that I changed to use the preview Skia build, and it build and ran (my top level UI displays in the browser, and the browser dev tools show the workers being present), but then it hit other problems before getting to the AvaloniaEdit parts... I'll try to test it with a more minimal test later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants