# Upgrade 3 to 4

This is a work in progress. Please send a PR with any amendments.

Also see the [4.0 milestone](https://github.com/shouldly/shouldly/milestone/2?closed=1).

## Class constraint added to `ShouldNotBeNull`

In previous versions it was possible to assert that a non-nullable type `ShouldNotBeNull`, even though this logically makes no sense. For exmaple, the following would happily compile, but of course could never cause a test failure:

```
const long value = 1;

value.ShouldNotBeNull();
```

The `class` constraint was added to `ShouldNotBeNull` in v4, which means the above code will no longer compile. This is a good thing because it allows you to find and fix nonsensical tests in your codebase!

## `Func<string> customMessage` removed

All overloads that accepted a `Func<string> customMessage` have been changed to `string customMessage`.

## Diff tool functionality moved to DiffEngine

Diff tool functionality is now provided by [DiffEngine](https://github.com/VerifyTests/DiffEngine).

As such, the following APIs have been removed:

* `Shouldly.Configuration.DiffTool`
* `ShouldlyConfiguration.DiffTools`
* `Shouldly.Configuration.IShouldNotLaunchDiffTool`
* `Shouldly.Configuration.DiffToolConfiguration`
* `Shouldly.Configuration.KnownDiffTools`
* `Shouldly.Configuration.KnownDoNotLaunchStrategies`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shouldly.org/documentation/3to4.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
