You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: NullReferenceException in MessageService.ShowMessageBarAsync #4674
I see about 30 NullReferenceException errors per week from MessageService.ShowMessageBarAsync in my app.
I have a component that references IMessageService and can call ShowMessageBarAsync. But this sometimes errors. I think the problem is ShowMessageBarAsync assumes that OnMessageItemsUpdatedAsync has been subscribed to:
There is a race between OnInitialize in the two controls causing NullReferenceExceptions.
💁 Possible Solution
MessageService doesn't call the event if it isn't registered?
Also, isn't AllMessages not thread safe? The lock around it just locks while accessing the property. A copy isn't being returned so a message could be added to it while the message bar provider is enumerating the collection, causing an error. Either a copy needs to be made here, or a copy is made each time the message list is modifed.
🔦 Context
🌍 Your Environment
OS & Device: [e.g. MacOS, iOS, Windows, Linux] on [iPhone 7, PC]
Browser [e.g. Microsoft Edge, Google Chrome, Apple Safari, Mozilla FireFox]
.NET and Fluent UI Blazor library Version [e.g. 8.0.2 and 4.4.1]
Activity
fix: NullReferenceException and thread safety in MessageService
Implement #4677 (Fix #4674) in correct branch
Rollup PRs #4677 and and #4678 (#4680)