Skip to content

remove redudnant cast to IReadOnlyList and add a not null ckeck in AssemblyEnumeratorTests #5402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

SimonCropp
Copy link
Contributor

…semblyEnumeratorTests

@Youssef1313 Youssef1313 enabled auto-merge (squash) April 7, 2025 13:32
…dd-a-not-null-ckeck-in-AssemblyEnumeratorTests
…dd-a-not-null-ckeck-in-AssemblyEnumeratorTests

Verify(types is not null);
Copy link
Member

Choose a reason for hiding this comment

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

This assert is failing. It's because the mocking two lines above is throwing ReflectionTypeLoadException passing null array.

Copy link
Member

Choose a reason for hiding this comment

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

NOTE: The failure is .NET Framework only, due to difference in ReflectionTypeLoadException implementation between .NET Core and .NET Framework.

When the constructor in .NET Core receives null, it sets the property to empty array:

https://github.com/dotnet/runtime/blob/0e94dca5b3203cdb9077dd543d87f1a69ff7eb40/src/libraries/System.Private.CoreLib/src/System/Reflection/ReflectionTypeLoadException.cs#L23

This is not the case for .NET Framework.

…dd-a-not-null-ckeck-in-AssemblyEnumeratorTests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants