-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
CSS hot reload fails in .NET MAUI Blazor app after 2nd edit #9197
Comments
This may just require closing out the maui/src/BlazorWebView/src/Maui/Windows/WinUIWebViewManager.cs Lines 86 to 91 in d94a1ad
|
@danroth27 I'm unable to repro this, did you have any other steps you'd recommend trying? |
I ended up being able to repro using a clean I think this'll be resolved if we can resolve #9206, at which point, we'll likely end up running into MicrosoftEdge/WebView2Feedback#2513 as we'd no longer be copying the content stream into a separate memory stream. Not the ideal resolution, but it would be good to get these related but different issues into the same "base" issue. |
#9254 has been merged. Once the builds for that are available, it would be good to revalidate this. |
Things should've now propagated. I've requested revalidation for this scenario using the latest (internal) builds. |
I tried to build a project in maui-blazor in 17.4 Preview 1. Changing CSS doesn't reflect in the running app. I am not sure if it's happening after the 2nd exit. This is the stack track I receive from VS, I am running it in Windows machine (Same machine where VS is running) StreamJsonRpc.RemoteInvocationException: The solution does not contain the specified document. |
@anirugu that appears to be a different issue. The issue we're discussing here doesn't explicitly throw an exception as far as I know. Based on the stack trace you provided, I suspect you may be running into dotnet/sdk#26762 which we're in the middle of patching. |
Unfortunately, the issue seems to continue to reproduce despite the recent changes. fyi/ @javiercn |
Adding to RC2 milestone. |
@javiercn could this have any relation to dotnet/sdk#26762 / dotnet/sdk#26765 / dotnet/sdk#27102? @danroth27 just confirming your issue here was on .NET 6? |
Reopening as @jinzhao1127 is still repro'ing this issue. #9645 should've resolved this. Specifically: |
I haven't been able to repro this given I'm running into https://github.com/aspnet/AspNetCore-ManualTests/issues/1525 first. Will have to hold off on further investigation here till https://github.com/aspnet/AspNetCore-ManualTests/issues/1525 is resolved. |
@mcumming pointed out the following discrepency: vs. in the VS Hot reload output:
Notice the difference in path. |
Making this change: here: maui/src/BlazorWebView/src/Maui/Windows/WinUIWebViewManager.cs Lines 105 to 113 in 8a9088f
results in Process Explorer reporting no processes holding the However, hot reload still fails on:
Given this is a distinctly different file from what was being reported by Process Explorer (see above post), I think we may actually have two separate bugs here. One would be resolved by the code change above, while there appears to be another bug that's resulting in the underlying failed hot reload issue persisting. Note, @MackinnonBuck was able to confirm, it does in fact repro on Android (thanks Mackinnon!). So this definitely doesn't appear to be platform specific. @mcumming why is this reading from the project folder, whereas we're performing hot reload from the packaged app (screenshot below). (cc/ @javiercn as I believe he may have worked with packaging in this context). |
@TanayParikh For MAUI we read from the project folder because that is the file that the user is modifying. The instance of that file in the packaged folder is not updated that I know of after the initial build. That is why for content files HotReload sends the entire contents of the file to the agent in the running application. |
Thanks for clarifying. What's unclear in that case is what is actually holding on to the file handle. Nothing shows up in process explorer. Did you have a chance to experiment with alternatives to the current File.ReadAllBytes in UITools? Perhaps we could try to open a file stream (with file sharing explicitly configured) and then copy to a memory stream to see if that potentially results in different behavior? |
Yes, I switched the |
We're trying out a temporary mitigation of this within VS at the moment. |
Closing this, as a mitigation from @mcumming has landed already. |
Repro steps:
Expected result: 2nd edit is successfully applied
Actual result:
Process Explorer shows that the app is holding onto the file:
@TanayParikh @mkArtakMSFT @mcumming
This issue is similar to the CSS hot reload issue with WinForms, but the behavior is different and the way Blazor handles the file stream is different on .NET MAUI which should avoid the WebView2 locking issue. In this case it seems like Blazor or .NET MAUI may be the culprit.
The text was updated successfully, but these errors were encountered: