Skip to content

Conversation

@vitek-karas
Copy link
Member

The core already recognized empty array as no args, but null means the same thing.

This change also:

  • Fixes a bug when PublicConstructors was required but only PublicParameterlessConstructor were provided the warning message would not say what the requirement was.
  • Fixes another bug where Activator.CreateInstance(... NonPublic ) (only NonPublic binding) will not accept PublicParameterlessConstructor
  • Simplifies some of the code
  • Better matching for UnrecognizedReflectionAccessPattern and warnings in tests
  • Added tests

Fixes #2110

The core already recognized empty array as no args, but null means the same thing.

This change also:
* Fixes a bug when PublicConstructors was required but only PublicParameterlessConstructors were provided the warning message would not say what the requirement was.
* Simplifies some of the code
* Better matching for UnrecognizedReflectionAccessPattern and warnings in tests
* Added tests
@vitek-karas vitek-karas added this to the .NET 6.0 milestone Jun 24, 2021
@vitek-karas vitek-karas requested review from mateoatr and tlakollo June 24, 2021 15:18
@vitek-karas vitek-karas self-assigned this Jun 24, 2021
@vitek-karas vitek-karas requested a review from marek-safar as a code owner June 24, 2021 15:18
@vitek-karas vitek-karas merged commit c3d69fb into dotnet:main Jul 12, 2021
@vitek-karas vitek-karas deleted the FixActivatorCreateInstanceWithNull branch July 12, 2021 19:27
agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
…et/linker#2111)

The core already recognized empty array as no args, but null means the same thing.

This change also:
* Fixes a bug when PublicConstructors was required but only PublicParameterlessConstructors were provided the warning message would not say what the requirement was.
* Simplifies some of the code
* Better matching for UnrecognizedReflectionAccessPattern and warnings in tests
* Added tests

Commit migrated from dotnet/linker@c3d69fb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Passing null args and BindingFlags.Public to Activator.CreateInstance is showing warnings even though type has DAM.PublicParameterlessConstructor

2 participants