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.