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

Can't use Microsoft.Extensions.DependencyInjection in wasm #17838

Closed
xuxiaokang0723 opened this issue Dec 27, 2024 · 5 comments
Closed

Can't use Microsoft.Extensions.DependencyInjection in wasm #17838

xuxiaokang0723 opened this issue Dec 27, 2024 · 5 comments

Comments

@xuxiaokang0723
Copy link

Describe the bug

The nuget package is also referenced, and there is no error in compilation. It can run normally in desktop mode. Switching to browser mode captures an error in debugging:
"The type 'lServiceCollection' is defined in an assembly that is not referenced.you must add a reference to assembly "Microsot Extensions,Dependencyiniection Abstractions,Verion=8.0.00, Cuture=neutral.PublickeyToken=adb9793829ddae60'"

To Reproduce

none

Expected behavior

No response

Avalonia version

11.2.2

OS

WebAssembly

Additional context

No response

@timunie
Copy link
Contributor

timunie commented Dec 27, 2024

I don't see how that should be our issue. Seems like you should add the nuget described in the error message explicitly.

@timunie timunie added question and removed bug labels Dec 27, 2024
@xuxiaokang0723
Copy link
Author

我不明白这应该如何成为我们的问题。似乎您应该明确添加错误消息中描述的 nuget。
In short, dependency injection is invalid in wasm mode. Because it can run normally in desktop mode。
image
d442d4ca61563006883091d98ab63269

@xuxiaokang0723
Copy link
Author

我不明白这应该如何成为我们的问题。似乎您应该明确添加错误消息中描述的 nuget。简而言之,依赖注入在 wasm 模式下是无效的。因为它可以在桌面模式下正常运行。
image
d442d4ca61563006883091d98ab63269

I don't know what's going on? Do I need to do some special configuration for wasm projects?

@xuxiaokang0723
Copy link
Author

xuxiaokang0723 commented Dec 27, 2024

I found that not only dependency injection cannot be used, as long as I switch to Browser mode, many packages in the public project will be prompted to be not found

@timunie
Copy link
Contributor

timunie commented Dec 27, 2024

Maybe create blank new project and add the dependency 1 by 1 to figure out where it breaks. Still nothing that we can fix for you. However you are welcome to ask questions on telegram or GitHub discussions

@timunie timunie closed this as not planned Won't fix, can't repro, duplicate, stale Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants