C# Nullable Context

We had an older project that we are updating to C#11 and .NET 7.0 and noticed that the nullable compiler warnings were not showing. These are turned on in new projects (C#8.0 and above in VS2022 etc) by default.

But if you load an older project and look in the project properties, you will see the dropdown empty:

Select ‘Enable’ in this setting and the compiler warning will show. For example:

Write to Test Detail Summary

Using xunit use the ITestOutputHelper interface to write to the Test Detail Summary pane of the Test Explorer.

You will need the xunit.runner.visualstudio package installed.

using Xunit; using Xunit.Abstractions; public class MyTestClass { private readonly ITestOutputHelper output; public MyTestClass(ITestOutputHelper output) { this.output = output; } [Fact] public void MyTest() { var temp = “my class!”; output.WriteLine(“This is output from {0}”, temp); } }