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

Document how to setup callbacks for native dependencies in Blazor WebAssembly #23661

Closed
danroth27 opened this issue Oct 27, 2021 · 7 comments · Fixed by #23668
Closed

Document how to setup callbacks for native dependencies in Blazor WebAssembly #23661

danroth27 opened this issue Oct 27, 2021 · 7 comments · Fixed by #23668

Comments

@danroth27
Copy link
Member

danroth27 commented Oct 27, 2021

[EDIT by guardrex to add the metadata]

See dotnet/runtime#60824 (comment).

@lewing @radical @lambdageek


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@lambdageek
Copy link
Member

You read my mind, Dan. I was just about to open an issue

@guardrex
Copy link
Collaborator

This is currently a section of the Blazor WASM host and deploy doc at ...

https://docs.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly?view=aspnetcore-6.0#native-dependencies-support

@danroth27 ... I'm 👂 if you prefer a dedicated topic for this content. I could set that up along with the work to resolve this issue. If a dedicated topic, do you want it in the Host and deploy node?

@danroth27
Copy link
Member Author

Native dependencies aren't really a deployment concern; they are a development concern. You need to be able to use your native dependencies during development. So I think this deserves a dedicated topic.

@guardrex
Copy link
Collaborator

I'll set it up first thing tomorrow morning with the updates to address this issue. Seems like it will be one of our "floating" Blazor topics out in the open Blazor node.

@GeorgeS2019
Copy link

@guardrex @danroth27

Currently the section Blazor WebAssembly: Use (native) libraries which uses SkiaSharp as an example

The mentioned SkiaSharp.Views.Blazor has the following dependencies
image

one of the dependencies: SkiaSharp.NativeAssets.WebAssembly packs a static library libskiasharp.a
image

Questions1

==> for users who are interested to use other native libraries (e.g. TorchSharp.NativeAssets.WebAssembly) in Blazor WebAssembly, we need elaboration on how to create such nuget and what files to be included and how to organize them.

Question2

The TorchSharp native assets are huge. Is there size limit of currently implementation of Blazor WebAssembly for using native libraries?

@Alan-FGR
Copy link

Hey guys, I came across this problem in which having a C#9 function ptr in the [DllImport]-decorated definition won't work, so I've instead used just a normal pointer (thanks so much @lambdageek for pointing that out). However, I'm quite confused since all related threads are closed. Is that the proper way to do it or is that going to be fixed at some point? I wish that stuff was better documented and more discoverable as I spent a ton of time assuming I was doing things wrong, and then searching the internet to no avail :(
In any case, keep up the good work! I'm resurrecting an old game engine of mine and it's been a joy to rewrite bits in modern C# and also make it run on the web too :D... I'm also using source generation for a lot of stuff and it scratches all my itches for the lack of templates, and in a much better fashion than template metaprogramming I must say! :)

@guardrex
Copy link
Collaborator

@Alan-FGR ... Normally, we don't work on closed issues/PRs, so I would direct you to open a new issue from the bottom of the native deps topic. However, it looks like from your remark that you should file a support request with the product unit instead. Open for them at ...

https://github.com/dotnet/aspnetcore/issues

Please add ...

cc: @guardrex https://github.com/dotnet/AspNetCore.Docs/issues/23661#issuecomment-1438929109

... to the bottom of your opening comment so that I can follow along. I might open a new docs issue for the native deps article based on what they say. I'll keep an 👁️ on your issue if you open one over there.

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

Successfully merging a pull request may close this issue.

6 participants