With the release of .NET 5 it was finally time to try record types. Here is my first attempt that I copied from the documentation:
Unfortunately this turned out not the success I was hoping for. Visual Studio returned the following error message:
Severity | Code | Description | Project | File | Line | Suppression State |
Error | CS0518 | Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported | NHibernate.Tests | C:\NHibernate.Tests\Domain\Product.cs | 17 | Active |
The error is not very descriptive but the reason I got it because I forgot to update the project to .NET 5. The fix was easy; after updating the target framework the error disappeared: