Skip to content

Enable <Nullable> in tests project and address warnings #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Serilog.Sinks.Network.Test/JsonFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Serilog.Sinks.Network.Test
{
public class JsonFormatter
{
private static LoggerAndSocket ConfigureTestLogger(ITextFormatter formatter = null)
private static LoggerAndSocket ConfigureTestLogger(ITextFormatter? formatter = null)
{
var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Bind(new IPEndPoint(IPAddress.Loopback, 0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>Preview</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog.Formatting.Compact" Version="3.0.0" />
Expand Down
4 changes: 2 additions & 2 deletions Serilog.Sinks.Network.Test/WhenLoggingViaTcp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Serilog.Sinks.Network.Test
{
public class WhenLoggingViaTcp
{
private static LoggerAndSocket ConfigureTestLogger(ITextFormatter formatter = null)
private static LoggerAndSocket ConfigureTestLogger(ITextFormatter? formatter = null)
{
var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Bind(new IPEndPoint(IPAddress.Loopback, 0));
Expand Down Expand Up @@ -66,7 +66,7 @@ public async Task CanLogWithProperties()
using var fixture = ConfigureTestLogger();
fixture.Logger.Information("TCP Hello {location}", "world");
var receivedData = await ServerPoller.PollForReceivedData(fixture.Socket);
dynamic payload = JsonConvert.DeserializeObject<ExpandoObject>(receivedData);
dynamic? payload = JsonConvert.DeserializeObject<ExpandoObject>(receivedData);
if (payload == null)
{
throw new AssertionFailedException("expected payload not null");
Expand Down
2 changes: 1 addition & 1 deletion Serilog.Sinks.Network.Test/WhenLoggingViaUdp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Serilog.Sinks.Network.Test
{
public class WhenLoggingViaUdp
{
private static LoggerAndSocket ConfigureTestLogger(ITextFormatter formatter = null)
private static LoggerAndSocket ConfigureTestLogger(ITextFormatter? formatter = null)
{
var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
socket.Bind(new IPEndPoint(IPAddress.Loopback, 0));
Expand Down
Loading