"The current thread is not associated with the Dispatcher" with OnInitializedAsync() #569
-
I have the following the test code: var filtTab = RenderComponent<FilterTable<BatchVMDTO>>(
parameters => parameters
.Add(p => p.GetFunc, GetData)
);
await filtTab.InvokeAsync(() =>
{
filtTab.WaitForAssertion(
() =>
Assert.Equal(
"Displaying 1 to 100 of 1000 / 1000",
filtTab.Find("#pager-count").InnerHtml
)
);
}
); The
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Have you tried the following?: var filtTab = RenderComponent<FilterTable<BatchVMDTO>>(
parameters => parameters
.Add(p => p.GetFunc, GetData)
);
filtTab.WaitForAssertion(
() =>
Assert.Equal(
"Displaying 1 to 100 of 1000 / 1000",
filtTab.Find("#pager-count").InnerHtml
)
); |
Beta Was this translation helpful? Give feedback.
-
If I understand correctly what you are writing, then you need to wrap your call to StateHasChanged into an InvokeAsync call in your component. E.g.:
However, if you have the code you list above, then you are likely doing something unusual in Blazor. I cannot think of a reason why you would call |
Beta Was this translation helpful? Give feedback.
If I understand correctly what you are writing, then you need to wrap your call to StateHasChanged into an InvokeAsync call in your component. E.g.:
However, if you have the code you list above, then you are likely doing something unusual in Blazor. I cannot think of a reason why you would call
StateHasChanged
from a new task you manually create withTask.Run
.