xUnit MemberData only returns one test

I found this issue when the test data is very large (some large JSON and GraphQL query strings). For some reason MemberData only generates one test, probably some limitation or an edge case that xUnit does not handle.

In this case, the way to solve this problem is to generate a very small test parameter, and then in the test run the generation code to create other test values. Then xUnit will work correctly.

Cannot connect to MSSQL database from .NET 6 application

If you encounter SSL error when a .NET 6 application tries to connect to the MSSQL database

Microsoft.Data.SqlClient.SqlException : A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 – The certificate chain was issued by an authority that is not trusted.)
System.ComponentModel.Win32Exception : The certificate chain was issued by an authority that is not trusted.

Not sure why, it might be that the new libraries are more strict regarding security. A workaround is to add TrustServerCertificate=True to the connection string.

NuGet package restore failed Access to path is denied

This turned out to be a problem when NuGet packages are checked in to the source control system in folder packages.

The problem occurs when

  • Automatically restore missing NuGet packages is turned on in Visual Studio.
  • There are NuGet packages checked in to the source control system.
  • The TFS work space is a server work space.

When VS tries to restore NuGet packages, it will try to access the existing packages already in TFS, because the packages are read only as the workspace is a server workspace. VS will be denied access to the path to the package.

To solve this, either delete the existing packages, or turn off automatic package restore in Visual Studio.

The correct way is to have no packages checked in to the source control system, either keep the project up to date with NuGet, or create a local cache of packages.