Skip to content

Conversation

@tmat
Copy link
Member

@tmat tmat commented Apr 16, 2025

Fixes Hot Reload in MAUI projects (or any projects that set SingleTargetBuildForStartupProjects msbuild property).

These projects only build the target that's being launched. Other targets are left stale.

EnC analyzer assumed that, unless something went wrong, the binaries of all projects that were built are up to date with the state of the solution. That's not the case in this scenario.
To fix the issue, we track stale projects along with committed solution. The committed solution is used during an edit session as a baseline for emitting module deltas.
Whenever the changes are successfully applied we set the committed solution to the current solution snapshot (of the main workspace).

When a document is changed during edit session we first check if we have a baseline document whose content matches the PDB, so that we can emit precise difference between the baseline and the current content.
If it does not, we consider the entire containing project stale. Any changes to a stale project or its documents are ignored until the project gets rebuilt.

The debugger recently added an API that's called whenever a project is rebuilt (UpdateProjectBaseline). We remove the project from the stale list and update the status of all its documents in that call.

Fixed issues:
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2442521
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2433992
dotnet/maui#27612

Follow up:

@tmat tmat requested a review from a team as a code owner April 16, 2025 01:10
@ghost ghost added Area-Interactive untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 16, 2025
@tmat
Copy link
Member Author

tmat commented Apr 16, 2025

@davidwengier @DustinCampbell ptal

@CyrusNajmabadi
Copy link
Member

If it does not, we consider the entire containing project stale. Any changes to a stale project or its documents are ignored until the project gets rebuilt.

Love it. Out of curiousity, does EnC log its decisions anywhere?

@tmat
Copy link
Member Author

tmat commented Apr 16, 2025

If it does not, we consider the entire containing project stale. Any changes to a stale project or its documents are ignored until the project gets rebuilt.

Love it. Out of curiousity, does EnC log its decisions anywhere?

Yes, Hot Reload output pane has the detailed logs if enabled in tools options.

@CyrusNajmabadi
Copy link
Member

Overall concept is great. I'm not qualified to know for certain if it is implemented properly :)

where TKey : notnull
{
#if NET
// .NET supports removing while enumerating:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, you're operating on IDictionary, not Dictionary here. so this is assume all IDictionaries support this.

@tmat tmat mentioned this pull request Apr 22, 2025
@tmat tmat merged commit 8205001 into dotnet:main Apr 22, 2025
25 checks passed
@tmat tmat deleted the MultiTfmUpToDateCheck branch April 22, 2025 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Interactive untriaged Issues and PRs which have not yet been triaged by a lead VSCode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants