Skip to content

Commit

Permalink
fix: Adjust hot reload support for VS 2022
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Nov 28, 2021
1 parent c2ddc8f commit a6727d8
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using Microsoft.CodeAnalysis;
Expand Down Expand Up @@ -56,11 +57,17 @@ internal void Update(GeneratorExecutionContext context)
}
}

if(GetIsDesignTimeBuild(context) && !GetIsHotReloadHost(context))
if(GetIsDesignTimeBuild(context)
&& !GetIsHotReloadHost(context)
&& !Process.GetCurrentProcess().ProcessName.Equals("devenv", StringComparison.InvariantCultureIgnoreCase))
{
// Design-time builds need to clear runs for the x:Name values to be regenerated, in the context of OmniSharp.
// In the context of HotReload, we need to skip this, as the HotReload service sets DesignTimeBuild to build
// to true, preventing existing runs to be kept active.
//
// Devenv is also added to the conditions as there's no explicit way
// for knowing that we're in a hot-reload session.
//
_runs.Clear();
}
}
Expand Down

0 comments on commit a6727d8

Please sign in to comment.