Skip to content

Fix bug in NativeMethods implementation - #1852

Merged
shimat merged 1 commit into
mainfrom
fix_NativeMethods_bug
Mar 31, 2026
Merged

shimat merged 1 commit into
mainfrom
fix_NativeMethods_bug

Conversation

@shimat

@shimat shimat commented Mar 31, 2026 •

Copy link
Copy Markdown
Owner

This pull request updates the platform detection logic in the IsWasm() method to improve compatibility with newer .NET versions.

Platform detection update:

  • Updated the preprocessor directive in the IsWasm() method of NativeMethods.cs from #if NET6_0 to #if NET5_0_OR_GREATER, ensuring that the WebAssembly architecture check works correctly on .NET 5.0 and later versions.

Summary by CodeRabbit

  • Refactor
    • Adjusted conditional compilation targets in platform detection logic to expand support for additional .NET target frameworks, including improved WebAssembly architecture detection.

@shimat shimat self-assigned this Mar 31, 2026
@coderabbitai

coderabbitai Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4d4356e7-e160-4042-b24b-ae3e12746a0b

📥 Commits

Reviewing files that changed from the base of the PR and between 6e4c249 and 007639f.

📒 Files selected for processing (1)
  • src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods.cs

📝 Walkthrough

Walkthrough

This PR adjusts conditional compilation directives and formatting in the NativeMethods.cs file. The primary semantic change widens the version condition in IsWasm() from NET6_0 to NET5_0_OR_GREATER, allowing earlier .NET versions to execute the Wasm architecture check. Remaining changes involve indentation adjustments across multiple methods.

Changes

Cohort / File(s) Summary
Conditional Compilation & Formatting
src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods.cs
Updated indentation in StringUnmanagedTypeNotWindows and IsUnix() methods; widened IsWasm() version condition from #if NET6_0 to #if NET5_0_OR_GREATER, allowing NET5_0 and above to evaluate Wasm architecture check instead of returning false.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Fix bug in NativeMethods implementation' is vague and does not clearly convey the specific nature of the change - expanding WASM detection to .NET 5.0+. Consider a more specific title like 'Expand WASM platform detection to .NET 5.0+' to clearly communicate the main change in the changeset.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix_NativeMethods_bug

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@shimat
shimat merged commit ef767e1 into main Mar 31, 2026
10 checks passed
@shimat
shimat deleted the fix_NativeMethods_bug branch March 31, 2026 15:03
@shimat shimat added the bug Confirmed defect in OpenCvSharp label Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Confirmed defect in OpenCvSharp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant