Skip to content
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

Fix internal errors when IsReturnExceptionStackTraceInErrorDetail is enabled (#809) #810

Merged
merged 3 commits into from
Jul 17, 2024
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 .github/workflows/build-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- main
- vNext
- release/**
tags:
- "!*" # not a tag push
paths-ignore:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- main
- vNext
- release/**
tags:
- "!*" # not a tag push
paths-ignore:
Expand Down
7 changes: 0 additions & 7 deletions MagicOnion.sln
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{B561
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AuthSample", "tests\samples\AuthSample\AuthSample.csproj", "{4D5E8486-9A0D-444A-922B-1D94FD8A820A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BasicServerSample", "tests\samples\BasicServerSample\BasicServerSample.csproj", "{BC29EA94-6C52-4FAA-8F26-9346DB85C58F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagicOnion.Client.Tests", "tests\MagicOnion.Client.Tests\MagicOnion.Client.Tests.csproj", "{6DF31417-D091-4E27-963F-75E1D5AC0EA0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagicOnion.Integration.Tests", "tests\MagicOnion.Integration.Tests\MagicOnion.Integration.Tests.csproj", "{EC4E0789-6A32-42FA-ABD7-7ED3A5004CFF}"
Expand Down Expand Up @@ -188,10 +186,6 @@ Global
{4D5E8486-9A0D-444A-922B-1D94FD8A820A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D5E8486-9A0D-444A-922B-1D94FD8A820A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D5E8486-9A0D-444A-922B-1D94FD8A820A}.Release|Any CPU.Build.0 = Release|Any CPU
{BC29EA94-6C52-4FAA-8F26-9346DB85C58F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC29EA94-6C52-4FAA-8F26-9346DB85C58F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC29EA94-6C52-4FAA-8F26-9346DB85C58F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC29EA94-6C52-4FAA-8F26-9346DB85C58F}.Release|Any CPU.Build.0 = Release|Any CPU
{6DF31417-D091-4E27-963F-75E1D5AC0EA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6DF31417-D091-4E27-963F-75E1D5AC0EA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6DF31417-D091-4E27-963F-75E1D5AC0EA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -303,7 +297,6 @@ Global
{A8550C24-2486-49DA-8D1A-DB6BBB2E9905} = {42EBB7E4-52D7-4E57-80AD-79FDD4900E13}
{B5617CC1-55FD-4F77-BA75-9450474C6527} = {7ACC27E8-8FBE-4807-B91F-B89AF3CFF7E0}
{4D5E8486-9A0D-444A-922B-1D94FD8A820A} = {B5617CC1-55FD-4F77-BA75-9450474C6527}
{BC29EA94-6C52-4FAA-8F26-9346DB85C58F} = {B5617CC1-55FD-4F77-BA75-9450474C6527}
{6DF31417-D091-4E27-963F-75E1D5AC0EA0} = {7ACC27E8-8FBE-4807-B91F-B89AF3CFF7E0}
{EC4E0789-6A32-42FA-ABD7-7ED3A5004CFF} = {7ACC27E8-8FBE-4807-B91F-B89AF3CFF7E0}
{D0555A91-D817-4322-B8D0-16641069D17B} = {B5617CC1-55FD-4F77-BA75-9450474C6527}
Expand Down
4 changes: 2 additions & 2 deletions src/MagicOnion.Server/MethodHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ void BindHandlerTyped<TRequest, TResponse, TRawRequest, TRawResponse>(ServiceBin
{
isErrorOrInterrupted = true;
context.Status = ex.ToStatus();
response = default;
response = default(TResponse?);

// WORKAROUND: Grpc.AspNetCore.Server throws a `Cancelled` status exception when it receives `null` response.
// To return the status code correctly, we needs to rethrow the exception here.
Expand Down Expand Up @@ -292,7 +292,7 @@ void BindHandlerTyped<TRequest, TResponse, TRawRequest, TRawResponse>(ServiceBin

context.Status = new Status(StatusCode.Unknown, str);
MagicOnionServerLog.Error(Logger, ex, context);
response = default;
response = default(TResponse?);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
<ProjectReference Include="..\..\src\MagicOnion.Client\MagicOnion.Client.csproj" />
<ProjectReference Include="..\..\src\MagicOnion.Server\MagicOnion.Server.csproj" />
<ProjectReference Include="..\samples\AuthSample\AuthSample.csproj" />
<ProjectReference Include="..\samples\BasicServerSample\BasicServerSample.csproj" />
<ProjectReference Include="..\samples\MagicOnionEngineTest\MagicOnionEngineTest.csproj" />
<ProjectReference Include="..\samples\MagicOnionTestServer\MagicOnionTestServer.csproj" />
</ItemGroup>
Expand Down
15 changes: 15 additions & 0 deletions tests/MagicOnion.Server.Tests/MagicOnionApplicationFactory.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Concurrent;
using Microsoft.Extensions.Logging;

namespace MagicOnion.Server.Tests;

#pragma warning disable CS1998
public class MagicOnionApplicationFactory<TServiceImplementation> : WebApplicationFactory<MagicOnionTestServer.Program>
{
public const string ItemsKey = "MagicOnionApplicationFactory.Items";
public ConcurrentDictionary<string, object> Items => Services.GetRequiredKeyedService<ConcurrentDictionary<string, object>>(ItemsKey);
public List<string> Logs { get; } = new();

protected override void ConfigureWebHost(IWebHostBuilder builder)
{
builder.ConfigureLogging(logger =>
{
logger.AddFakeLogging(options =>
{
options.OutputFormatter = x => $"{x.Timestamp}\t{x.Level}\t{x.Id}\t{x.Message}\t{x.Exception}";
options.OutputSink = x => Logs.Add(x);
});
});
builder.ConfigureServices(services =>
{
services.AddKeyedSingleton<ConcurrentDictionary<string, object>>(ItemsKey);
services.AddMagicOnion(new[] { typeof(TServiceImplementation) });
});
}
Expand Down
Loading
Loading