[
https://issues.apache.org/jira/browse/THRIFT-6374?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jens Geyer resolved THRIFT-6374.
--------------------------------
Fix Version/s: 0.26.0
Assignee: Jens Geyer
Resolution: Fixed
> netstd tutorial server does not start with -tr:http
> ---------------------------------------------------
>
> Key: THRIFT-6374
> URL: https://issues.apache.org/jira/browse/THRIFT-6374
> Project: Thrift
> Issue Type: Bug
> Components: netstd - Library, Tutorial
> Affects Versions: 0.24.0
> Reporter: Jens Geyer
> Assignee: Jens Geyer
> Priority: Minor
> Fix For: 0.26.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> {{Server \-tr:http}} in the netstd tutorial stops at startup, so none of the
> HTTP samples can be run:
> {noformat}
> crit: Microsoft.AspNetCore.Hosting.Diagnostics[6]
> Application startup exception
> System.InvalidOperationException: Multiple constructors accepting all
> given argument types have been found in type
> 'Thrift.Transport.Server.THttpServerTransport'. There should only be one
> applicable constructor.
> at
> Microsoft.Extensions.DependencyInjection.ActivatorUtilities.TryFindMatchingConstructor(Type
> instanceType, Type[] argumentTypes, ConstructorInfo& matchingConstructor,
> Nullable`1[]& parameterMap)
> at
> Microsoft.Extensions.DependencyInjection.ActivatorUtilities.FindApplicableConstructor(Type
> instanceType, Type[] argumentTypes, ConstructorInfoEx[] constructors,
> ConstructorInfo& matchingConstructor, Nullable`1[]& matchingParameterMap)
> at
> Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider
> provider, Type instanceType, Object[] parameters)
> at
> Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.ReflectionMiddlewareBinder.CreateMiddleware(RequestDelegate
> next)
> at Microsoft.AspNetCore.Builder.ApplicationBuilder.Build()
> at
> Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken
> cancellationToken)
> {noformat}
> The tutorial adds the middleware with
> {{app.UseMiddleware<THttpServerTransport>()}}
> ([Server/Program.cs:366|https://github.com/apache/thrift/blob/bcdf956895aeac5411ce3029ab8b33901b7c7a36/tutorial/netstd/Server/Program.cs#L366]).
> The only argument the activator gets is the {{RequestDelegate}}, and all
> three public {{THttpServerTransport}} constructors accept one, so it cannot
> choose.
> Passing the processor and a configuration explicitly fixes it:
> {code:java}
> app.UseMiddleware<THttpServerTransport>(app.ApplicationServices.GetRequiredService<ITAsyncProcessor>(),
> new TConfiguration());
> {code}
> With that line the server starts, and {{Client \-tr:http}} completes all its
> calls.
> Checked on master (bcdf956) with the .NET 10.0.401 SDK. The tutorial server
> and {{THttpServerTransport}} are the same on master, release/0.25.0 and
> release/0.24.0. No CI job builds or runs {{tutorial/netstd}}.
> _Drafted with AI assistance (Claude Opus 5.5)._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)