Skip to content

Commit

Permalink
Merge pull request #196 from nenoNaninu/fix_nullable_annotation
Browse files Browse the repository at this point in the history
Fix nullable annotation
  • Loading branch information
nenoNaninu committed Apr 2, 2024
2 parents c05a885 + b91c102 commit f7c2cd8
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public static string CreateParameterTypeArrayString(this MethodMetadata methodMe

if (methodMetadata.Parameters.Count == 1)
{
return $"new[] {{ typeof({methodMetadata.Parameters[0].TypeName}) }}";
return $"new[] {{ typeof({methodMetadata.Parameters[0].Type.ToDisplayString(SymbolDisplayFormatRule.FullyQualifiedFormat)}) }}";
}

var sb = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<Compile Include="..\TypedSignalR.Client.Tests\Hubs\ReceiverTest.cs" LinkBase="Hubs" />
<Compile Include="..\TypedSignalR.Client.Tests\Hubs\StreamingTest.cs" LinkBase="Hubs" />
<Compile Include="..\TypedSignalR.Client.Tests\Hubs\UnaryTest.cs" LinkBase="Hubs" />
<Compile Include="..\TypedSignalR.Client.Tests\Hubs\NullableHubTest.cs" LinkBase="Hubs" />
<!--<Compile Include="..\TypedSignalR.Client.Tests\Hubs\NullableHubTest.cs" LinkBase="Hubs" />-->
</ItemGroup>

</Project>
10 changes: 10 additions & 0 deletions tests/TypedSignalR.Client.Tests.Shared/INullableTestHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,13 @@ public interface INullableTestHub
Task<string> GetReferenceType(string message);
Task<string?> GetNullableReferenceType(string? message);
}


public interface INullableTestIReceiver
{
Task<int> GetStruct(int message);
Task<int?> GetNullableStruct(int? message);

Task<string> GetReferenceType(string message);
Task<string?> GetNullableReferenceType(string? message);
}
29 changes: 29 additions & 0 deletions tests/TypedSignalR.Client.Tests/Hubs/NullableHubTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,33 @@ public async Task GetNullableReferenceType2()

await hubConnection.StopAsync(_cancellationTokenSource.Token);
}

private void CompileTest()
{
var hubConnection = CreateHubConnection("/Hubs/NullableTestHub", HttpTransportType.WebSockets);
hubConnection.Register<INullableTestIReceiver>(new NullableTestIReceiver());
}

private class NullableTestIReceiver : INullableTestIReceiver
{
public Task<string?> GetNullableReferenceType(string? message)
{
throw new NotImplementedException();
}

public Task<int?> GetNullableStruct(int? message)
{
throw new NotImplementedException();
}

public Task<string> GetReferenceType(string message)
{
throw new NotImplementedException();
}

public Task<int> GetStruct(int message)
{
throw new NotImplementedException();
}
}
}

0 comments on commit f7c2cd8

Please sign in to comment.