Skip to content

Update Castle.Core to 5.2.1#948

Closed
Romfos wants to merge 1 commit intonsubstitute:mainfrom
Romfos:castle
Closed

Update Castle.Core to 5.2.1#948
Romfos wants to merge 1 commit intonsubstitute:mainfrom
Romfos:castle

Conversation

@Romfos
Copy link
Copy Markdown
Contributor

@Romfos Romfos commented Feb 28, 2026

Change:

  • Bump Castle.Core to 5.2.1

related: #830

@Romfos Romfos requested a review from Copilot February 28, 2026 15:03
@Romfos Romfos mentioned this pull request Feb 28, 2026
26 tasks
@Romfos Romfos marked this pull request as ready for review February 28, 2026 15:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates NSubstitute’s Castle DynamicProxy dependency to Castle.Core 5.2.1 and adjusts related proxy/call plumbing to align with updated nullability annotations.

Changes:

  • Bump Castle.Core NuGet dependency from 5.1.1 to 5.2.1.
  • Update proxy/call internals to use nullable-aware Func<object?>? base-method delegates.
  • Add null-forgiving operators where the code relies on non-null runtime guarantees (e.g., InvocationTarget, CreateInstance).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/NSubstitute/NSubstitute.csproj Updates Castle.Core package reference to 5.2.1.
src/NSubstitute/Proxies/CastleDynamicProxy/CastleInvocationMapper.cs Adjusts base-method delegate typing and refines guard logic using property patterns.
src/NSubstitute/Core/ICallFactory.cs Updates base-method delegate nullability annotations in the public interface.
src/NSubstitute/Core/CallFactory.cs Propagates updated base-method delegate type to the implementation.
src/NSubstitute/Core/Call.cs Updates stored base-method delegate type and keeps call-base behavior nullable-safe.
src/NSubstitute/Proxies/CastleDynamicProxy/ProxyIdInterceptor.cs Applies null-forgiving operator for InvocationTarget to satisfy updated nullability.
src/NSubstitute/Proxies/CastleDynamicProxy/CastleDynamicProxyFactory.cs Applies null-forgiving operator for Activator.CreateInstance(...) to satisfy updated nullability.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@304NotModified 304NotModified left a comment

Choose a reason for hiding this comment

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

I'm sorry to block this, but there is a issue in Castle.Core 5.2.1 that wasn't in 5.1.1

See castleproject/Core#684

This will be fixed in Castle.Core 6

I will create a PR to show this issue (the test will fail with Castle.Core 5.2.1) - updated, see #950

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.

Building main with Castle.Core 5.2.1 gives build errors (Possible null reference) & has an issue with default interface implementations

3 participants