controlflow / resharper-heapview

ReSharper Heap Allocations Viewer plugin
MIT License
303 stars 28 forks source link

Analyzer 'ReSharperPlugin.HeapView.Analyzers.AllocationOfClosuresAnalyzer' threw the following exception: AttachedDisplayClass #116

Closed ForNeVeR closed 1 year ago

ForNeVeR commented 1 year ago

In Rider from 2023.1 EAP5 to 2023.2 EAP6, we receive an exception with the following stack trace:

Summary: Analyzer 'ReSharperPlugin.HeapView.Analyzers.AllocationOfClosuresAnalyzer' threw the following exception: AttachedDisplayClass

Description:
JetBrains Rider 2023.2 Build RD-232.8296.16 Date 2023-06-25T22:11:04.165+0000

--- EXCEPTION #1/2 [AssertionException]
Message = AttachedDisplayClass
ExceptionPath = Root.InnerException
ClassName = JetBrains.Diagnostics.Assertion+AssertionException
HResult = COR_E_EXCEPTION=80131500
Source = JetBrains.Lifetimes
StackTraceString = "
  at JetBrains.Diagnostics.Assertion.Fail(String message) in Fail.il:line IL_0006 mvid 117E
     at ReSharperPlugin.HeapView.Analyzers.DisplayClassStructure.ClosureCaptures.ReSharperPlugin.HeapView.Analyzers.IClosureCaptures.get_AttachedDisplayClass() in /mnt/agent/work/a1bd0292f01549c5/src/dotnet/ReSharperPlugin.HeapView/Analyzers/DisplayClassStructure.cs:line 859
     at ReSharperPlugin.HeapView.Analyzers.AllocationOfClosuresAnalyzer.<ReportDelegateAllocation>g__CollectImplicitCapturesThatCanContainReferences|7_0(HashSet`1 consumer, IClosureCaptures captures, ElementProblemAnalyzerData data) in /mnt/agent/work/a1bd0292f01549c5/src/dotnet/ReSharperPlugin.HeapView/Analyzers/AllocationOfClosuresAnalyzer.cs:line 379
     at ReSharperPlugin.HeapView.Analyzers.AllocationOfClosuresAnalyzer.ReportDelegateAllocation(ICSharpClosure closure, IType delegateType, IClosureCaptures captures, IHighlightingConsumer consumer, ElementProblemAnalyzerData data) in /mnt/agent/work/a1bd0292f01549c5/src/dotnet/ReSharperPlugin.HeapView/Analyzers/AllocationOfClosuresAnalyzer.cs:line 350
     at ReSharperPlugin.HeapView.Analyzers.AllocationOfClosuresAnalyzer.ReportClosureInvocation(ICSharpClosure closure, DisplayClassStructure structure, ElementProblemAnalyzerData data, IHighlightingConsumer consumer) in /mnt/agent/work/a1bd0292f01549c5/src/dotnet/ReSharperPlugin.HeapView/Analyzers/AllocationOfClosuresAnalyzer.cs:line 294
     at ReSharperPlugin.HeapView.Analyzers.AllocationOfClosuresAnalyzer.Run(ITreeNode treeNode, ElementProblemAnalyzerData data, IHighlightingConsumer consumer) in /mnt/agent/work/a1bd0292f01549c5/src/dotnet/ReSharperPlugin.HeapView/Analyzers/AllocationOfClosuresAnalyzer.cs:line 55
     at ReSharperPlugin.HeapView.Analyzers.HeapAllocationAnalyzerBase`1.JetBrains.ReSharper.Feature.Services.Daemon.IElementProblemAnalyzer.Run(ITreeNode element, ElementProblemAnalyzerData data, IHighlightingConsumer consumer) in /mnt/agent/work/a1bd0292f01549c5/src/dotnet/ReSharperPlugin.HeapView/Analyzers/HeapAllocationAnalyzerBase.cs:line 14
     at JetBrains.ReSharper.Feature.Services.Daemon.ElementProblemAnalyzerRegistrar.ElementAnalyzerDispatcher.Run(ITreeNode element, IHighlightingConsumer consumer) in Run.il:line IL_0063 mvid B328
"

--- Outer ---

--- EXCEPTION #2/2 [LoggerException]
Message = "Analyzer 'ReSharperPlugin.HeapView.Analyzers.AllocationOfClosuresAnalyzer' threw the following exception: AttachedDisplayClass"
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
InnerException = “Exception #1 at Root.InnerException"
HResult = COR_E_APPLICATION=80131600
StackTraceString = "
  at JetBrains.Util.Logging.Logger.LogException(String comment, Exception ex) in LogException.il:line IL_0000 mvid F606
     at JetBrains.ReSharper.Feature.Services.Daemon.ElementProblemAnalyzerRegistrar.ElementAnalyzerDispatcher.Run(ITreeNode element, IHighlightingConsumer consumer) in Run.il:line IL_0019 mvid B328
     at JetBrains.ReSharper.Daemon.CSharp.Stages.CSharpErrorStageProcess.ProcessAfterInterior(ITreeNode element, IHighlightingConsumer consumer) in ProcessAfterInterior.il:line IL_0000 mvid E488
     at JetBrains.ReSharper.Daemon.CSharp.Stages.CSharpIncrementalDaemonStageProcessBase.<>c__DisplayClass4_0.<Execute>g__MemberHighlighter|0(ICSharpTypeMemberDeclaration declaration) in CSharpIncrementalDaemonStageProcessBase.il:line IL_002C mvid E488 or CSharpIncrementalDaemonStageProcessBase.il:line IL_005A mvid E488
     at JetBrains.ReSharper.Daemon.CSharp.Stages.CSharpIncrementalDaemonStageProcessBase.<>c__DisplayClass4_2.<Execute>b__3() in CSharpIncrementalDaemonStageProcessBase.il:line IL_002C mvid E488 or CSharpIncrementalDaemonStageProcessBase.il:line IL_005A mvid E488
     at JetBrains.Application.Threading.Tasks.TaskHost.AccessViolationCatcher(Action action) in AccessViolationCatcher.il:line IL_0000 mvid F606
     at JetBrains.Application.Threading.Tasks.TaskHost.<>c__DisplayClass38_0`1.<Create>b__0(Object state) in TaskHost.il:line IL_00AB mvid F606
     at System.Threading.Tasks.Task`1.InnerInvoke() in InnerInvoke.il:line IL_002B mvid AD95
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in RunInternal.il:line IL_0040 mvid AD95
     at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) in ExecuteWithThreadLocal.il:line IL_0096 mvid AD95
     at System.Threading.Tasks.Task.ExecuteEntry() in ExecuteEntry.il:line IL_0036 mvid AD95
     at JetBrains.Application.Threading.Tasks.Scheduler.JetScheduler.ExecuteTask(Task task) in ExecuteTask.il:line IL_0014 mvid F606
     at JetBrains.Application.Threading.Tasks.Scheduler.JetSchedulerThread.EnqueueNextTask() in EnqueueNextTask.il:line IL_0009 mvid F606
     at JetBrains.Application.Threading.Tasks.Scheduler.JetSchedulerThread.ThreadPoolProc() in ThreadPoolProc.il:line IL_0197 mvid F606
     at JetBrains.Application.Threading.Tasks.Scheduler.JetSchedulerThread.StartProc() in StartProc.il:line IL_0000 mvid F606
     at System.Threading.Thread.StartCallback() in StartCallback.il:line IL_000E mvid AD95
"
controlflow commented 1 year ago

Repro code:

class Foo
{
  void Usage()
  {
    void Local() { }
    var f = () => Local();
  }
}