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

Dependency injection crashes if you try to inject two instances of the same type #16265

Closed
rstropek opened this issue Apr 2, 2018 · 2 comments
Labels
area-blazor Includes: Blazor, Razor Components

Comments

@rstropek
Copy link

rstropek commented Apr 2, 2018

If you create a component that injects multiple instances of the same type, it compiles fine but throws an exception during runtime. Example:

@inject MyTransientService Transient
@inject MyTransientService Transient2
@SteveSandersonMS
Copy link
Member

Thanks for reporting it. It's a bug in Mono, reported as mono/mono#7944

@galvesribeiro
Copy link
Member

Just to add more to the issue, I have the same problem using JSON.Net with Blazor.

To repro, call Newtonsoft.Json.JsonConvert.SerializeObject(new { CurrentCount = currentCount }); and you will have the same problem.

image

@mkArtakMSFT mkArtakMSFT transferred this issue from dotnet/blazor Oct 27, 2019
@mkArtakMSFT mkArtakMSFT added the area-blazor Includes: Blazor, Razor Components label Oct 27, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

No branches or pull requests

4 participants