You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add MemberAccessException and MissingMethodException - #316
Added MemberAccessException, MissingMemberException and MissingMethodException to mscorlib (reflection build), with the .NET hierarchy.
Activator.CreateInstance<T>() throws MissingMethodException for abstract types, interfaces and types without a public parameterless constructor, as .NET.
Updated the Activator unit tests to the new exception.
Added unit tests for the public constructor lookup, abstract and open generic types, and casts at and over the generic limits.
Motivation and Context
nanoCLR was throwing NotSupportedException where .NET throws these exceptions; the types didn't exist.
They are also used by the nanoCLR for ConstructorInfo.Invoke of abstract and open generic types (MemberAccessException).
Behaviour change: code catching NotSupportedException from Activator.CreateInstance<T>() has to catch MissingMethodException.
Auto reviews are disabled on base/target branches other than the default branch.
Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Central YAML; Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Advanced
Run ID: 85fc5a4b-96b7-4ab5-8775-a0e5a50c1b1e
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
New Features
Added standard member-access and missing-member exception types for reflection-enabled applications.
Bug Fixes
Activator.CreateInstance<T>() now throws MissingMethodException when the type is abstract or has no public parameterless constructor.
The change adds three reflection exception types and updates Activator.CreateInstance<T>() to throw MissingMethodException when a type is abstract or lacks a public parameterless constructor. The related test expectations also change.
Activator.CreateInstance<T>() documents and throws MissingMethodException for the described construction failures. The tests now expect that exception.
This adds standard reflection exception types and changes Activator.CreateInstance to throw MissingMethodException instead of NotSupportedException. Callers that catch NotSupportedException will need to catch the new type. The change looks safe to merge.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "Add MemberAccessException and MissingMethodException" names the main change: two new exception types added to the reflection build. It does not mention the Activator.CreateInstance() beh…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description is on-topic. It states that MemberAccessException, MissingMemberException and MissingMethodException are added to the reflection build of mscorlib. It states that Activator.CreateInsta…
Full details: Title check
Explanation
The title "Add MemberAccessException and MissingMethodException" names the main change: two new exception types added to the reflection build. It does not mention the Activator.CreateInstance<T>() behavior change or the test updates, but it refers to a real and central part of the changeset.
Full details: Description check
Explanation
The description is on-topic. It states that MemberAccessException, MissingMemberException and MissingMethodException are added to the reflection build of mscorlib. It states that Activator.CreateInstance<T>() now throws MissingMethodException for abstract types, interfaces, and types without a public parameterless constructor. It also lists the updated Activator unit tests, the new tests, and the behaviour change for callers that catch NotSupportedException. These points match the changeset and the PR objectives.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
The native contract hash of nanoFramework.CoreLibrary has changed. The native declaration in nf-interpretermust be updated before this package can be released.
- Add tests for the public constructor lookup and for abstract and open generic types.
- Add tests for casts at and over the generic node and nesting limits.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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
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.
Description
MemberAccessException,MissingMemberExceptionandMissingMethodExceptionto mscorlib (reflection build), with the .NET hierarchy.Activator.CreateInstance<T>()throwsMissingMethodExceptionfor abstract types, interfaces and types without a public parameterless constructor, as .NET.Activatorunit tests to the new exception.Motivation and Context
NotSupportedExceptionwhere .NET throws these exceptions; the types didn't exist.ConstructorInfo.Invokeof abstract and open generic types (MemberAccessException).NotSupportedExceptionfromActivator.CreateInstance<T>()has to catchMissingMethodException.How Has This Been Tested?
Screenshots
Types of changes
Checklist: