Skip to content

Commit 9d90ab8

Browse files
Chris Martinezcommonsensesoftware
Chris Martinez
authored andcommitted
Fix IControllerConfiguration recursion. Fixes #313.
1 parent 5462d2f commit 9d90ab8

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/Microsoft.AspNet.WebApi.Versioning.ApiExplorer/Description/VersionedApiExplorer.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,11 @@ IEnumerable<ApiVersion> FlattenApiVersions()
458458

459459
foreach ( var controllerType in controllerTypes )
460460
{
461-
var descriptor = new HttpControllerDescriptor( Configuration, Empty, controllerType );
461+
var descriptor = new HttpControllerDescriptor()
462+
{
463+
Configuration = Configuration,
464+
ControllerType = controllerType,
465+
};
462466

463467
options.Conventions.ApplyTo( descriptor );
464468

@@ -773,16 +777,17 @@ void PopulateActionDescriptions(
773777

774778
var documentation = DocumentationProvider?.GetDocumentation( actionDescriptor );
775779
var bodyParameter = parameterDescriptions.FirstOrDefault( description => description.Source == FromBody );
780+
var formatters = actionDescriptor.Configuration.Formatters;
776781
var supportedRequestBodyFormatters =
777782
bodyParameter != null ?
778-
Configuration.Formatters.Where( f => f.CanReadType( bodyParameter.ParameterDescriptor.ParameterType ) ) :
783+
formatters.Where( f => f.CanReadType( bodyParameter.ParameterDescriptor.ParameterType ) ) :
779784
Enumerable.Empty<MediaTypeFormatter>();
780785

781786
var responseDescription = CreateResponseDescription( actionDescriptor );
782787
var returnType = responseDescription.ResponseType ?? responseDescription.DeclaredType;
783788
var supportedResponseFormatters =
784789
( returnType != null && returnType != typeof( void ) ) ?
785-
Configuration.Formatters.Where( f => f.CanWriteType( returnType ) ) :
790+
formatters.Where( f => f.CanWriteType( returnType ) ) :
786791
Enumerable.Empty<MediaTypeFormatter>();
787792

788793
supportedRequestBodyFormatters = GetInnerFormatters( supportedRequestBodyFormatters );

src/Microsoft.AspNet.WebApi.Versioning.ApiExplorer/Microsoft.AspNet.WebApi.Versioning.ApiExplorer.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<VersionPrefix>1.2.0</VersionPrefix>
4+
<VersionPrefix>1.2.1</VersionPrefix>
55
<AssemblyVersion>1.2.0.0</AssemblyVersion>
66
<TargetFramework>net45</TargetFramework>
77
<AssemblyTitle>Microsoft ASP.NET Web API Versioned API Explorer</AssemblyTitle>
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<ReleaseNotes Include="Support substituting API version parameter in route templates (Issue 247)" />
15+
<ReleaseNotes Include="Fix IControllerConfiguration recursion (Issue 313)" />
1616
</ItemGroup>
1717

1818
<ItemGroup>

0 commit comments

Comments
 (0)