Skip to content

Cleanup dead delegate code#129662

Merged
jkotas merged 16 commits into
dotnet:mainfrom
MichalPetryka:dead-delegate
Jun 27, 2026
Merged

Cleanup dead delegate code#129662
jkotas merged 16 commits into
dotnet:mainfrom
MichalPetryka:dead-delegate

Conversation

@MichalPetryka

Copy link
Copy Markdown
Contributor

Split off from #99200

cc @jkotas

@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jun 21, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke
See info in area-owners.md if you want to be subscribed.

Comment thread src/coreclr/vm/comdelegate.cpp Outdated
Comment thread src/coreclr/System.Private.CoreLib/src/System/Delegate.CoreCLR.cs Outdated
Comment thread src/coreclr/System.Private.CoreLib/src/System/Delegate.CoreCLR.cs Outdated
Comment thread src/coreclr/debug/daccess/dacdbiimpl.cpp
Comment thread src/coreclr/System.Private.CoreLib/src/System/Delegate.CoreCLR.cs Outdated
Comment thread src/coreclr/System.Private.CoreLib/src/System/Delegate.CoreCLR.cs Outdated
Comment thread src/coreclr/vm/comdelegate.cpp Outdated
@MichalPetryka

Copy link
Copy Markdown
Contributor Author

@jkotas Can you review this next so that I can rebase #99200?

@jkotas

jkotas commented Jun 26, 2026

Copy link
Copy Markdown
Member

The diagnostic tests are failing with number of errors. Example of failure:

System.InvalidOperationException : Field not found in any layout (names=[InvocationList]).

   at Microsoft.Diagnostics.DataContractReader.Generated.LayoutSet.Select(TargetPointer address, TypeInfo& type, TargetPointer& baseAddr, String& name, ReadOnlySpan`1 names) in /_/artifacts/obj/Microsoft.Diagnostics.DataContractReader.Contracts/Debug/Microsoft.Diagnostics.DataContractReader.DataGenerator/Microsoft.Diagnostics.DataContractReader.DataGenerator.CdacGenerator/LayoutSet.g.cs:line 60
   at Microsoft.Diagnostics.DataContractReader.Data.Delegate..ctor(Target target, TargetPointer address) in /_/artifacts/obj/Microsoft.Diagnostics.DataContractReader.Contracts/Debug/Microsoft.Diagnostics.DataContractReader.DataGenerator/Microsoft.Diagnostics.DataContractReader.DataGenerator.CdacGenerator/Microsoft_Diagnostics_DataContractReader_Data.Delegate.g.cs:line 38
   at Microsoft.Diagnostics.DataContractReader.Data.Delegate.Microsoft.Diagnostics.DataContractReader.Data.IData<Microsoft.Diagnostics.DataContractReader.Data.Delegate>.Create(Target target, TargetPointer address) in /_/artifacts/obj/Microsoft.Diagnostics.DataContractReader.Contracts/Debug/Microsoft.Diagnostics.DataContractReader.DataGenerator/Microsoft.Diagnostics.DataContractReader.DataGenerator.CdacGenerator/Microsoft_Diagnostics_DataContractReader_Data.Delegate.g.cs:line 50
   at Microsoft.Diagnostics.DataContractReader.TestInfrastructure.TestPlaceholderTarget.DefaultDataCache.GetOrAdd[T](TargetPointer address) in /_/src/native/managed/cdac/tests/TestInfrastructure/TestPlaceholderTarget.cs:line 570
   at Microsoft.Diagnostics.DataContractReader.Contracts.Object_1.GetDelegateInfo(TargetPointer address) in /_/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Object_1.cs:line 164
   at Microsoft.Diagnostics.DataContractReader.Tests.ObjectTests.GetDelegateInfo_Multicast(Architecture arch) in /_/src/native/managed/cdac/tests/UnitTests/ObjectTests.cs:line 445
   at InvokeStub_ObjectTests.GetDelegateInfo_Multicast(Object, Span`1)
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

Comment thread src/coreclr/debug/daccess/dacdbiimpl.cpp Outdated
Comment thread src/coreclr/vm/comdelegate.cpp Outdated
Comment thread src/coreclr/vm/comdelegate.cpp Outdated
Comment thread src/coreclr/System.Private.CoreLib/src/System/MulticastDelegate.CoreCLR.cs Outdated
MichalPetryka and others added 4 commits June 26, 2026 13:11
Comment thread src/libraries/System.Private.CoreLib/src/System/Delegate.cs Outdated
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@MichalPetryka

Copy link
Copy Markdown
Contributor Author

The diagnostic tests are failing with number of errors. Example of failure:

System.InvalidOperationException : Field not found in any layout (names=[InvocationList]).

   at Microsoft.Diagnostics.DataContractReader.Generated.LayoutSet.Select(TargetPointer address, TypeInfo& type, TargetPointer& baseAddr, String& name, ReadOnlySpan`1 names) in /_/artifacts/obj/Microsoft.Diagnostics.DataContractReader.Contracts/Debug/Microsoft.Diagnostics.DataContractReader.DataGenerator/Microsoft.Diagnostics.DataContractReader.DataGenerator.CdacGenerator/LayoutSet.g.cs:line 60
   at Microsoft.Diagnostics.DataContractReader.Data.Delegate..ctor(Target target, TargetPointer address) in /_/artifacts/obj/Microsoft.Diagnostics.DataContractReader.Contracts/Debug/Microsoft.Diagnostics.DataContractReader.DataGenerator/Microsoft.Diagnostics.DataContractReader.DataGenerator.CdacGenerator/Microsoft_Diagnostics_DataContractReader_Data.Delegate.g.cs:line 38
   at Microsoft.Diagnostics.DataContractReader.Data.Delegate.Microsoft.Diagnostics.DataContractReader.Data.IData<Microsoft.Diagnostics.DataContractReader.Data.Delegate>.Create(Target target, TargetPointer address) in /_/artifacts/obj/Microsoft.Diagnostics.DataContractReader.Contracts/Debug/Microsoft.Diagnostics.DataContractReader.DataGenerator/Microsoft.Diagnostics.DataContractReader.DataGenerator.CdacGenerator/Microsoft_Diagnostics_DataContractReader_Data.Delegate.g.cs:line 50
   at Microsoft.Diagnostics.DataContractReader.TestInfrastructure.TestPlaceholderTarget.DefaultDataCache.GetOrAdd[T](TargetPointer address) in /_/src/native/managed/cdac/tests/TestInfrastructure/TestPlaceholderTarget.cs:line 570
   at Microsoft.Diagnostics.DataContractReader.Contracts.Object_1.GetDelegateInfo(TargetPointer address) in /_/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Object_1.cs:line 164
   at Microsoft.Diagnostics.DataContractReader.Tests.ObjectTests.GetDelegateInfo_Multicast(Architecture arch) in /_/src/native/managed/cdac/tests/UnitTests/ObjectTests.cs:line 445
   at InvokeStub_ObjectTests.GetDelegateInfo_Multicast(Object, Span`1)
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

Could somebody from cdac team assist here? I'm not sure how to get the multicast fields properly.

Comment thread src/libraries/System.Private.CoreLib/src/System/Delegate.cs Outdated
Comment thread src/coreclr/System.Private.CoreLib/src/System/Delegate.CoreCLR.cs Outdated
Comment thread src/coreclr/System.Private.CoreLib/src/System/MulticastDelegate.CoreCLR.cs Outdated
Comment thread src/coreclr/System.Private.CoreLib/src/System/MulticastDelegate.CoreCLR.cs Outdated
Comment thread src/coreclr/System.Private.CoreLib/src/System/MulticastDelegate.CoreCLR.cs Outdated
Comment thread src/coreclr/debug/daccess/dacdbiimpl.cpp Outdated
@MichalPetryka

Copy link
Copy Markdown
Contributor Author

@jkotas does it look good now?

@jkotas jkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@jkotas jkotas merged commit 0822067 into dotnet:main Jun 27, 2026
180 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-VM-coreclr community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants