Skip to content

Commit

Permalink
Fix using DependencyGraphViewer with AOT compilers
Browse files Browse the repository at this point in the history
The `readonly` addition was one of the 3600 diffs in dotnet#74825. `MarkStrategy` can have mutable state that was getting lost because Roslyn considers it valid to put `_marker` into a temporary before calling instance methods on it.

This resulted in DependencyGraphViewer hanging after seeing tens of thousands of new graphs being added.
  • Loading branch information
MichalStrehovsky committed Sep 29, 2022
1 parent bc27a6a commit e468f04
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace ILCompiler.DependencyAnalysisFramework
public sealed class DependencyAnalyzer<MarkStrategy, DependencyContextType> : DependencyAnalyzerBase<DependencyContextType> where MarkStrategy : struct, IDependencyAnalysisMarkStrategy<DependencyContextType>
{
#pragma warning disable SA1129 // Do not use default value type constructor
private readonly MarkStrategy _marker = new MarkStrategy();
private MarkStrategy _marker = new MarkStrategy();
#pragma warning restore SA1129 // Do not use default value type constructor
private DependencyContextType _dependencyContext;
private IComparer<DependencyNodeCore<DependencyContextType>> _resultSorter;
Expand Down

0 comments on commit e468f04

Please sign in to comment.