Skip to content

Remove non-public constructor checks from reflection test - #315

Merged
josesimoes merged 1 commit into
nanoframework:developfrom
josesimoes:relax-constructor-test
Nov 25, 2026
Merged

josesimoes merged 1 commit into
nanoframework:developfrom
josesimoes:relax-constructor-test

Conversation

@josesimoes

@josesimoes josesimoes commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Description

  • Removed the checks of SystemReflectionMemberTests_ConstructorInfo_Test2 that find internal and private constructors with GetConstructor and create an abstract class through its protected constructor.

Motivation and Context

  • .NET GetConstructor(Type[]) only returns public constructors and creating an abstract class throws, nanoCLR is going to do the same.
  • The public constructor checks stay, the test passes with the current and the new nanoCLR.
  • Related with Support for generics <T> Home#782.

How Has This Been Tested?

  • [tested against nanoclr BuildId 68291]

Screenshots

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue with code or algorithm)
  • New feature (non-breaking change which adds functionality to code)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Config and build (change in the configuration and build system, has no impact on code or features)
  • Dependencies (update dependencies and changes associated, has no impact on code or features)
  • Unit Tests (add new Unit Test(s) or improved existing one(s), has no impact on code or features)
  • Documentation (changes or updates in the documentation, has no impact on code or features)

Checklist:

  • My code follows the code style of this project (only if there are changes in source code).
  • My changes require an update to the documentation (there are changes that require the docs website to be updated).
  • I have updated the documentation accordingly (the changes require an update on the docs in this repo).
  • I have read the CONTRIBUTING document.
  • I have tested everything locally and all new and existing tests passed (only if there are changes in source code).
  • I have added new tests to cover my changes.

- Remove checks that rely on GetConstructor returning non-public constructors and creating abstract classes.
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Tests
    • Removed reflection checks for protected, internal, and private constructors. Coverage for the public parameterless constructor remains.

The constructor reflection test removes checks for the protected AbsTestClass(float), internal TestClass(int), and private TestClass(bool) constructors. Checks for the public parameterless TestClass constructor remain.

Changes: Constructor Reflection Test

Layer / File(s) Summary
Update constructor reflection checks
Tests/NFUnitTestSystemLibReflection/UnitTestReflectionMemberTest.cs
The test removes visibility, declaring type, and invocation checks for three non-public constructors. Checks for the public parameterless constructor remain.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other

Suggested labels: Type: Unit Tests

Merge Risk: Minimal · up to a2644

This change only trims a reflection unit test to match .NET behavior. It does not touch production code, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "Remove non-public constructor checks from reflection test" matches the change. The diff removes the GetConstructor checks for internal and private constructors and the abstract class creati…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description states that the PR removes the checks in SystemReflectionMemberTests_ConstructorInfo_Test2 that use GetConstructor to find internal and private constructors and create an abstract clas…
Full details: Title check

Explanation

The title "Remove non-public constructor checks from reflection test" matches the change. The diff removes the GetConstructor checks for internal and private constructors and the abstract class creation through the protected constructor from SystemReflectionMemberTests_ConstructorInfo_Test2. The title is 57 characters, which exceeds the preferred 50-character limit in the title requirements. It does not reference other PRs or issues and does not end with a full stop.

Full details: Description check

Explanation

The description states that the PR removes the checks in SystemReflectionMemberTests_ConstructorInfo_Test2 that use GetConstructor to find internal and private constructors and create an abstract class through its protected constructor. The raw summary confirms this change to the constructor reflection test. The description also gives the reason: GetConstructor(Type[]) returns only public constructors, and creating an abstract class throws. It also notes that the public constructor checks remain and that the test was run against nanoCLR BuildId 68291. The description is specific and matches the changeset, so the check passes.

  • 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.

Share

Recent review info

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: 0f5d6c9d-c767-4829-a622-147d0fabcee5
Commits

Reviewing files that changed from the base of the PR and between 71a7ccb and a26441d.

Files selected for processing: 1

  • Tests/NFUnitTestSystemLibReflection/UnitTestReflectionMemberTest.cs
Files with no reviewable changes: 1

  • Tests/NFUnitTestSystemLibReflection/UnitTestReflectionMemberTest.cs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@nfbot nfbot left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

✅ The PR template looks good now. Thanks!

@josesimoes

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

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.

@sonarqubecloud

Copy link
Copy Markdown

@nfbot

nfbot commented Nov 25, 2026

Copy link
Copy Markdown
Member

⚠️ Native declaration update required!

The native contract hash of nanoFramework.CoreLibrary has changed. The native declaration in nf-interpreter must be updated before this package can be released.

Previously published This build
Native contract hash 0x940E6E23 0x272B0DC7

👉 Tracking issue: nanoframework/Home#1957

The issue contains a link to the stubs artifact from this build and instructions for GitHub Copilot to perform the update.

@josesimoes
josesimoes merged commit 2410f3e into nanoframework:develop Nov 25, 2026
6 checks passed
@josesimoes
josesimoes deleted the relax-constructor-test branch November 25, 2026 14:19
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.

2 participants