Repository navigation
Removes unused/unreachable WinRT ContentType plumbing from assembly binding - #127629
Merged
Merged
Conversation
`BaseAssemblySpec::SetContentType` had no callers, and the only call to `AssemblyName::SetContentType` passed `AssemblyContentType_Default`, which is the value `m_kContentType` is already initialized to in the `AssemblyIdentity` constructor. Remove both `SetContentType` methods and replace the redundant call site with a flag-validation check. Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/7568770f-93f6-4aab-8674-88bae7a8e6f2 Co-authored-by: elinor-fung <[email protected]>
Now that `SetContentType` is gone, nothing sets `afContentType_WindowsRuntime` on `BaseAssemblySpec::m_dwFlags`. As a result, the WinRT propagation in `InitializeWithAssemblyIdentity`, `PopulateAssemblyNameData`, and the display-name output path are all dead, as are the WinRT-aware branches in `AssemblyName::Hash`/`Equals` (since `data.ContentType` can no longer be WinRT). Remove that dead plumbing along with the now-unused `AssemblyName::GetContentType` accessor. Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/7568770f-93f6-4aab-8674-88bae7a8e6f2 Co-authored-by: elinor-fung <[email protected]>
m_kContentType plumbing in CoreCLR assembly binder
Contributor
|
Tagging subscribers to this area: @agocke, @elinor-fung |
jkotas
approved these changes
May 1, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes unused/unreachable WinRT ContentType plumbing from the CoreCLR native assembly binding pipeline (VM BaseAssemblySpec ↔ binder AssemblyName/AssemblyIdentity), simplifying identity propagation, display-name formatting, and hashing/equality now that non-default content types are rejected/unsupported.
Changes:
- Removes
ContentTypepropagation fromBaseAssemblySpecinto binder identities /AssemblyNameData, and drops WinRT-aware display-name logic. - Removes
ContentTypestate and flags from binder identity/types (AssemblyIdentity::IDENTITY_FLAG_CONTENT_TYPE,m_kContentType,AssemblyNameData::ContentType, and related helpers). - Removes binder
AssemblyNamecontent-type accessor/mutator and simplifiesEquals/Hashby dropping the WinRT content-type branches; validates non-default content types as invalid.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/vm/coreassemblyspec.cpp | Removes content-type propagation/display logic from BaseAssemblySpec paths. |
| src/coreclr/vm/assemblyspec.hpp | Removes unused AssemblySpec::SetContentType API. |
| src/coreclr/binder/textualidentityparser.cpp | Removes unreachable ContentType= emission and the ContentTypeToString helper. |
| src/coreclr/binder/inc/bindertypes.hpp | Removes binder-local AssemblyContentType typedef and drops AssemblyNameData::ContentType. |
| src/coreclr/binder/inc/assemblyname.inl | Removes AssemblyName::GetContentType / SetContentType. |
| src/coreclr/binder/inc/assemblyname.hpp | Removes INCLUDE_CONTENT_TYPE and content-type accessors from AssemblyName API surface. |
| src/coreclr/binder/inc/assemblyidentity.hpp | Removes IDENTITY_FLAG_CONTENT_TYPE and m_kContentType from AssemblyIdentity. |
| src/coreclr/binder/assemblyname.cpp | Validates non-default content type as invalid; removes content-type state usage from init/hash/equals/display-name. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes unused/unreachable WinRT
ContentTypeplumbing from the CoreCLR native assembly binder andAssemblySpec. The cleanup is split into three commits, each one removing what becomes dead after the previous step.Commit 1 —
Remove unused SetContentType from AssemblySpec / AssemblyNameBaseAssemblySpec::SetContentTypehad no callers — removed.BINDER_SPACE::AssemblyName::SetContentTypepassedAssemblyContentType_Default, which is the valuem_kContentTypeis already initialized to in theAssemblyIdentityconstructor. The setter is removed and the redundant call site is replaced with a flag-validation check (IsAfContentType_Default) that returnsFUSION_E_INVALID_NAMEfor non-default content types.src/coreclr/binder/assemblyname.cpp,src/coreclr/binder/inc/assemblyname.hpp,src/coreclr/binder/inc/assemblyname.inl,src/coreclr/vm/assemblyspec.hpp.Commit 2 —
Remove dead WinRT ContentType plumbing in assembly binderWith
SetContentTypegone, nothing ever setsafContentType_WindowsRuntimeonBaseAssemblySpec::m_dwFlagsor marksIDENTITY_FLAG_CONTENT_TYPE. The corresponding branches were therefore unreachable and have been removed:BaseAssemblySpec::InitializeWithAssemblyIdentityandPopulateAssemblyNameData— theWindowsRuntimepropagation paths.BaseAssemblySpec::GetTextualIdentity— the WinRT-aware display-name path.BINDER_SPACE::AssemblyName::Equals/Hash— the WinRT-aware comparison/hash branches (data.ContentTypecan no longer beWindowsRuntime).BINDER_SPACE::AssemblyName::GetContentTypeaccessor — no remaining callers.Commit 3 —
Remove unused m_kContentType and surrounding plumbingAfter commits 1 and 2, the
m_kContentTypefield is only ever written from a zero-initializedAssemblyNameDataand read from a textual-identity branch that is never taken. Removed:AssemblyIdentity::m_kContentTypefield + ctor init, andAssemblyIdentity::IDENTITY_FLAG_CONTENT_TYPE.AssemblyNameData::ContentTypeand the corresponding write inAssemblyName::Init.AssemblyName::INCLUDE_FLAGS::INCLUDE_CONTENT_TYPE(and its contribution toINCLUDE_ALL), plus the two&= ~IDENTITY_FLAG_CONTENT_TYPEclears inHash/GetDisplayName.TextualIdentityParser::ToString's unreachableContentType=emission, and the now-orphanedContentTypeToStringhelper.__AssemblyContentTypetypedef inbindertypes.hpp— the binder no longer uses it.Out of scope
System.Reflection.AssemblyContentType(consumed by CoreLib).corhdr.h'safContentType_*flags (still consumed by ilasm/ildasm and the AOT toolchain).Validation
./build.sh clr+libssucceeds with 0 warnings, 0 errors at the tip of the branch.Note
This PR was authored with assistance from GitHub Copilot.
Plan checklist
BaseAssemblySpec::SetContentTypeandBINDER_SPACE::AssemblyName::SetContentTypeInitializeWithAssemblyIdentity/PopulateAssemblyNameData/GetTextualIdentity/Equals/Hash/GetContentTypem_kContentTypefield,IDENTITY_FLAG_CONTENT_TYPE,INCLUDE_CONTENT_TYPE,AssemblyNameData::ContentType,ContentTypeToStringhelper, and__AssemblyContentTypetypedefclr+libs— succeeded with 0 warnings / 0 errors