Skip to content

Commit f97890c

Browse files
committed
Allow nested types inside of the <Module> type
- This isn't disallowed by spec, although ilasm and ildasm cannot handle these cases - Simply skip adding the type to the available class hash. Backport of bugfix portion of PR #111435 Fixes #111164 in .NET 9
1 parent e781fb7 commit f97890c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/coreclr/vm/clsload.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3482,6 +3482,12 @@ VOID ClassLoader::AddAvailableClassHaveLock(
34823482
if (SUCCEEDED(pMDImport->GetNestedClassProps(classdef, &enclosing))) {
34833483
// nested type
34843484

3485+
if (enclosing == COR_GLOBAL_PARENT_TOKEN)
3486+
{
3487+
// Types nested in the <module> class can't be found by lookup.
3488+
return;
3489+
}
3490+
34853491
COUNT_T classEntryIndex = RidFromToken(enclosing) - 1;
34863492
_ASSERTE(RidFromToken(enclosing) < RidFromToken(classdef));
34873493
if (classEntries->GetCount() > classEntryIndex)

0 commit comments

Comments
 (0)