Closed ehinolakingsley closed 2 years ago
Can you elaborate? What's "broken"? An exception? If so, what is it?
Which version of .NET are you using?
I am using .Net 5 and what was broken is this! But when i downgraded to 3.2.1 i don't get this error.
Thank you. Is there any way you can provide an isolated demo of this happening?
I'm not catching it in my tests, and cannot reproduce it. I've seen this reported before and would like to fix it, but I can't seem to find an example of it happening.
I am sorry for my late response. I know right. I tried replicating it with a sample project but i can't also. I will find a way to.
I have to say this. God bless you for creating this library. It's very beautiful and made life very easy for me. Keep up this great work sir.
I noticed services.AddMediaQueryService(); was missing in the service. So i added it and i got the error above. But on 3.2.1 I didn't include it and it's still worked.
What i can do is if possible, we could schedule a meeting and debug together. Thanks
For what it is worth I am also seeing this and I have services.AddMediaQueryService(); in my startup. It's really problematic. I'm not so sure it isn't a side effect of the circuit getting disconnected. It's very strange. If you were able to resolve it for others I would love to find out how it got resolved.
This is what I am seeing and it causes the blazor server to terminate the connection which is highly problematic.
22T17:05:48.090Z] Error: Microsoft.JSInterop.JSException: dotnet reference was not found in the collection of media query lists
Error: dotnet reference was not found in the collection of media query lists
at BlazorSizeMedia.getMediaQueryListById (https://localhost:44351/_content/BlazorPro.BlazorSize/blazorSizeMedia.js:15:23)
at BlazorSizeMedia.addMediaQueryToList (https://localhost:44351/_content/BlazorPro.BlazorSize/blazorSizeMedia.js:26:35)
at Module.addMediaQueryToList (https://localhost:44351/_content/BlazorPro.BlazorSize/blazorSizeMediaModule.js:17:21)
at https://localhost:44351/_framework/blazor.server.js:1:70045
at new Promise (
I have a simple example project that I can send to @EdCharbeneau that at least demonstrates a pretty major issue for me that I think would shed some light.
I'm currently out of the office, but if you can email me at ed.charbeneau@gmail.com I can take a look Tuesday.
Were you able to send me the project? If so, please let me know what email you sent it from as it may have gotten filtered.
I rewrote the project to use the listener instead of the MediaQueryList. It seemed like a problem that is a lower level issue with the dotnet reference object possibly to do with the changes to support javascript isolation, not sure. The listener solved all of my problems so I just ran with that. I can readily reproduce the problem though by just creating an MVC project with .NET 5, add blazor server, create a component that uses the MediaQueryList and load that sucker up. That will do it.
@longhornleads I Just created an MVC Project with .NET 6 and added BlazorSize. I was unable to reproduce the error.
Index.cshtml
@(await Html.RenderComponentAsync<Component>(RenderMode.ServerPrerendered))
Component.razor
<MediaQueryList>
<MediaQuery Media="@Breakpoints.SmallDown">
<Matched>
<h3>Small</h3>
</Matched>
<Unmatched>
<h3>Large</h3>
</Unmatched>
</MediaQuery>
</MediaQueryList>
The latest nuget is broken. My app won't run. I had to downgrade to 3.2.1 to resolve the issue