Skip to content

DebuggerOptions initialization crashes within AggregatableAttribute.OnInstanceConstructed #9

@gfraiteur

Description

@gfraiteur

Copied from metalama/Metalama#619

Older VSX version, but it's unlikely to be fixed.

Metalama Application: Visual Studio Tools for Metalama and PostSharp
Metalama Version: 2024.2.14-rc
Runtime: .NET Framework 4.8.9256.0
Processor Architecture: X64
OS Description: Microsoft Windows 10.0.19045 
OS Architecture: X64
Exception type: System.Reflection.TargetInvocationException
Exception message: Exception has been thrown by the target of an invocation.
===== Exception ===== 
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary2.ValueCollection.Enumerator.MoveNext()
   at PostSharp.Patterns.Model.Advices.AggregatableDictionaryAdvice2.PostSharp.Patterns.Model.IAggregatable.VisitChildren(ChildVisitor visitor, ChildVisitorOptions options, Object state)
   at PostSharp.Patterns.Threading.ThreadAwareImpl.UpdateController(Object instance, Func2 useParentConcurrencyControllerMethod, IConcurrencyController parentController)
   at PostSharp.Patterns.Threading.ThreadAwareAdvice1.OnParentChangedCore()
   at PostSharp.Patterns.DynamicAdvising.DynamicAdviceList.Advise(Type type, Func2 createAdvice)
   at PostSharp.Patterns.Threading.ThreadAwareAttribute.Advise(Object obj)
   at PostSharp.Patterns.Model.AggregatableClientAttribute.AdviseRecursive(Object child, ChildInfo childInfo, Object state)
   at PostSharp.Patterns.Model.AggregatableClientAttribute.OnChildAttached(Object child, ChildInfo childInfo)
   at PostSharp.Patterns.Model.AggregatableAttribute.InvokeOnChildAttached(Object child, ChildInfo childInfo, Object state)
   at PostSharp.Patterns.Model.AggregatableAttribute.VisitChildrenCore(ChildVisitor visitor, ChildVisitorOptions options, Object state)
   at PostSharp.Patterns.Model.AggregatableAttribute.VisitChildren(ChildVisitor visitor, ChildVisitorOptions options, Object state)
   at PostSharp.Patterns.Model.AggregatableAttribute.VisitChildren(ChildVisitor visitor, ChildVisitorOptions options, Object state)
   at PostSharp.Patterns.Model.AggregatableAttribute.OnInstanceConstructed()
   at PostSharp.VisualStudio.Package.Services.Configuration.DebuggerOptions.OnInstanceConstructed()
   at PostSharp.VisualStudio.Package.Services.Configuration.DebuggerOptions..ctor(ConstructorDepth __depth)
   at PostSharp.VisualStudio.Package.Services.Configuration.DebuggerOptions..ctor()
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at PostSharp.VisualStudio.Abstractions.DependencyInjection.OwnServiceProvider.<>c__DisplayClass13_2.<GetOrCreateActivatorAsync>b__4()
   at Microsoft.VisualStudio.Threading.AsyncLazy1.<>c__DisplayClass16_0.<<GetValueAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at PostSharp.VisualStudio.Abstractions.DependencyInjection.OwnServiceProvider.<GetImplementationAsync>d__14.MoveNext()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions