All Versions
Latest Version
Avg Release Cycle
135 days
Latest Release
517 days ago

Changelog History
Page 1

  • v4.4.0 Changes

    July 01, 2022
    • [FIX] Fix issue checking for constructor args on null object. Thanks to @phongphanq, and @appel1! Thanks also to @Mandroide for code review. (#683, #685)
    • ⚡️ [UPDATE] Update to Castle Core v5. Thanks @Havunen! (#690, #673)
    • 🤡 [NEW] Add .ThrowsAsync() that will correctly mock exception on async methods. Thanks @Socolin! (#609, #663)
  • v4.3.0 Changes

    January 01, 2021
    • 👍 [NEW] Add .NET 5 (#636) and .NET 6 (#674) support. Thanks to @zvirja and @Havunen!
  • v4.2.2 Changes

    June 01, 2020

    Hi everyone,

    🚀 We've just released NSubstitute 4.2.2. This patch release fixes a thread-safety issue with auto-value providers (#600, #601). Thanks to Alex Povar (@zvirja) for these changes.

    📦 If you haven't already done so, please make sure you add the NSubstitute.Analyzers package wherever you reference NSubstitute:

    As always, please raise an issue on GitHub or email the group if you have any problems.

    🔄 Changelog:

    💥 Breaking changes: There should be no breaking changes with this release.

    Project links:

  • v4.2.1 Changes

    July 01, 2019
    • [FIX] It might be impossible to assign ref and out arguments using type-compatible value. (#577, @zvirja)
    • 🔧 [FIX] Configured result is returned in the Received.InOrder check causing tests to fail sometimes. (#569, @zvirja)
  • v4.2.0 Changes

    May 01, 2019
    • [FIX] Raise events for delegates taking single array argument of reference element type. (#560, @zvirja)
    • [NEW] Quantity.Within(min, max) to assert a call was received within a range of times. This is available in the NSubstitute.ReceivedExtensions namespace. (#558)
  • v4.1.0 Changes

    May 01, 2019
    • 🔧 [FIX] Re-throw captured NSubstitute exceptions when configuring async methods. (#533, @zvirja)
    • 🐎 [UPDATE] Various performance improvements. (#536, #542, #547, @zvirja)
    • ⚡️ [UPDATE] Use Castle.Proxy library to generate delegate proxies. (#537, @zvirja)
    • [FIX] Do not fail on nested generic type formatting. (#515, @zvirja)
    • [FIX] Fix event handling for code created by non-ECMA compliant compilers. (#500, #525, @zvirja)
    • ⚡️ [UPDATE] Thanks to Julian Verdurmen (@304NotModified) for updating our website and links to HTTPS! All links to the NSub website should now go through, 🌐 and other web links in the project also go through to HTTPS where supported.
    • 📚 [UPDATE] Documentation updates (#516 thanks to Michael Freidgeim @MNF; #530, #531 thanks to @304NotModified; #540, #549)
  • v4.0.0 Changes

    January 01, 2019

    Thanks to core team member Alex Povar (@zvirja) for putting a huge amount of work into 🚀 defining and implementing features, fixes and refactoring for this release! Also thanks to @tpodolak for the new NSubstitute.Analyzers project! Finally, thanks to everyone who submitted PRs, raised or commented on issues, or took the time to help answer questions on StackOverflow.

    Major new features and improvements

    • [NEW] NSubstitute.Analyzers project. 🔧 Uses Roslyn to detect potential problems with NSubstitute configurations, such as trying to substitute for non-virtual members. Whenever you add NSubstitute to your C# or VB project, 📦 don't forget to also add the corresponding NSubstitute.Analyzers package! Thanks to @tpodolak for starting and running this project!
    • [NEW] CallBase for enabling base method calls for specific methods. (#449, @zvirja)
    • [NEW][BREAKING] Arg matchers (Arg.Is etc) can now be used for ref and out arguments. 👀 See []( if you are still using pre-C#7. (#404, @zvirja)
    • 🔧 [NEW] Configure() extension in NSubstitute.Extensions.ConfigurationExtensions to 🔧 ensure NSubstitute handles the next call as a configuration/specification. (#350, @zvirja)
    • 🐎 [UPDATE] Performance improvements. (@zvirja)
      • CallResults performance optimisation
      • Delegate proxy generation improvements (#362)
      • Minimise allocations and LINQ use on hot code paths (#390)
      • Optimise array allocation (#395)
    • ⚡️ [UPDATE][BREAKING] Calls made with one or more argument matchers (Arg.Is or Arg.Any) 🔧 will no longer return previously configured results. NSubstitute will assume the call is 🔧 being configured and avoid running logic configured via previous Returns() calls. 👀 This helps fix some problems with overlapping configurations. See #345 and []( for more information. (@zvirja)

    🆕 New and improved debugging, errors and error messages

    • 🔧 [NEW] Raise CouldNotConfigureBaseMethodException when trying to configure a call to call a base method that does not exist. (#429, @zvirja)
    • [NEW] Raise RedundantArgumentMatcherException if extra arg matchers are detected. This is ✅ a huge help for immediately identifying misconfigured tests. (@zvirja)
    • ⚡️ [UPDATE] Improved AmbiguousArgumentsException behaviour and errors. (#403 and others; @zvirja)
    • [NEW] Improve debugging experience with proxy ids. (#39, @zvirja)
    • ⚡️ [UPDATE] Improved display of MatchArgs to help with debugging. (@zvirja)
    • ✅ [NEW][BREAKING] Detection of unused argument matchers. This helps to identify errors in tests due to incorrectly used argument matchers. (#361, #89, #279; @zvirja)

    And lots, lots more!

    Including (but not limited to):

    • 👍 [NEW] Support for netstandard-2.0. (#447, @zvirja)
    • [FIX] Improved handling of virtual calls in constructors. (#423, @zvirja)
    • 🔧 [NEW] Added a set of When() overloads to configure async methods without compilation warnings. (#468, @zvirja)
    • 🛠 [FIX] Fixed potential for ArgumentNullException on finalizer thread. (#382, @zvirja)
    • ⚡️ [UPDATE] Now using Castle.Core 4.3.1+. We :heart: you Castle.Core! (Thanks for the PR Alexandr Nikitin!)
    • [NEW] Expose .Received(Quantity) in NSubstitute.ReceivedExtensions namespace. Thanks to @firelizzard18 for this suggestion.
    • ⚡️ [UPDATE] Made substitute setup and verification more robust in the concurrent environments. (#462, @zvirja)
    • ⚡️ [UPDATE] Removed NSubstitute.Core.Extensions.Zip (no longer require NET35 support). (#336)
    • 📚 [FIX] Restored XML documentation. (#345)
    • [NEW] Made global NSubstitute customization more easier. (#448, @zvirja)
    • 📚 [UPDATE] Documentation updates and fixes. Thanks to @jsbed, Chris Maddock, Jim Aho (#369), and Mathias Lorenzen.
    • ⚡️ [UPDATE] Updated builds thanks to Alexandr Nikitin.
    • 🔨 [UPDATE] Significant refactoring thanks to Alex Povar. (#448 and many, many other PRs)
  • v4.0.0-rc1

    November 19, 2018
  • v3.1.0 Changes

    October 01, 2017
    • 📦 [FIX] Reduced packages required when referencing from NET45 and NET46. (#331)
    • ⚡️ [UPDATE] Reintroduced support for NET45. (#329)
    • 👍 [NEW] Support for auto-substituting ValueTask<T> results. Thanks to @KrzysztofBranicki for this change. (#325)
  • v3.0.1 Changes

    October 01, 2017
    • 🚀 [FIX] Signing 3.x release to prevent problems with other packages that work with different versions of NSubstitute. Thanks Alex Povar for raising this. (#324)
    • ⚡️ [UPDATE] Readme and other docs converted to markdown (.md) rather than plain text. Thanks to Stefan Kert for this PR.