3 types derived from ProblemDetails
Microsoft.AspNetCore.Http.Abstractions (1)
ProblemDetails\HttpValidationProblemDetails.cs (1)
12public class HttpValidationProblemDetails : ProblemDetails
Microsoft.AspNetCore.Http.Extensions.Tests (1)
ProblemDetailsDefaultWriterTest.cs (1)
709internal class CustomProblemDetails : ProblemDetails
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (1)
ProblemDetailsWrapperProviderFactoryTest.cs (1)
71private class CustomProblemDetails : ProblemDetails { }
56 instantiations of ProblemDetails
BasicWebSite (1)
Controllers\ContactApiController.cs (1)
103return NotFound(new ProblemDetails
Microsoft.AspNetCore.Diagnostics (1)
DeveloperExceptionPage\DeveloperExceptionPageMiddlewareImpl.cs (1)
253var problemDetails = new ProblemDetails
Microsoft.AspNetCore.Http.Abstractions (1)
ProblemDetails\ProblemDetailsContext.cs (1)
31get => _problemDetails ??= new ProblemDetails();
Microsoft.AspNetCore.Http.Abstractions.Tests (4)
ProblemDetailsContextTests.cs (1)
16ProblemDetails problemDetails = new();
ProblemDetailsJsonConverterTest.cs (3)
162var value = new ProblemDetails 193var value = new ProblemDetails 217var value = new ProblemDetails
Microsoft.AspNetCore.Http.Extensions.Tests (8)
ProblemDetailsDefaultWriterTest.cs (8)
30var expectedProblem = new ProblemDetails() 67var expectedProblem = new ProblemDetails() 130var originalProblemDetails = new ProblemDetails(); 133var expectedProblem = new ProblemDetails() 175var expectedProblem = new ProblemDetails() 215var expectedProblem = new ProblemDetails() 463var expectedProblem = new ProblemDetails(); 509var expectedProblem = new ProblemDetails();
Microsoft.AspNetCore.Http.Results (1)
TypedResults.cs (1)
788var problemDetails = new ProblemDetails
Microsoft.AspNetCore.Http.Results.Tests (19)
BadRequestOfTResultTests.cs (1)
88var details = new ProblemDetails { Status = StatusCodes.Status422UnprocessableEntity, };
ConflictOfTResultTests.cs (1)
35var obj = new ProblemDetails();
InternalServerErrorOfTResultTests.cs (1)
88var details = new ProblemDetails { Status = StatusCodes.Status422UnprocessableEntity, };
JsonResultTests.cs (3)
116var details = new ProblemDetails(); 174var details = new ProblemDetails() 225var details = new ProblemDetails { Status = StatusCodes.Status413RequestEntityTooLarge, };
ProblemResultTests.cs (10)
19var details = new ProblemDetails(); 48var details = new ProblemDetails(); 109var details = new ProblemDetails() 173var details = new ProblemDetails { Status = StatusCodes.Status413RequestEntityTooLarge, }; 195var result = new ProblemHttpResult(new()); 206var result = Assert.IsAssignableFrom<IStatusCodeHttpResult>(new ProblemHttpResult(new() { Status = StatusCodes.Status416RangeNotSatisfiable })); 214var result = Assert.IsAssignableFrom<IStatusCodeHttpResult>(new ProblemHttpResult(new())); 222var value = new ProblemDetails(); 234var value = new ProblemDetails(); 246var result = Assert.IsAssignableFrom<IContentTypeHttpResult>(new ProblemHttpResult(new()));
ResultsTests.cs (2)
1361var problem = new ProblemDetails { Title = "Test title" }; 1765(() => Results.Problem(new()), typeof(ProblemHttpResult)),
TypedResultsTests.cs (1)
1153var problem = new ProblemDetails { Title = "Test title" };
Microsoft.AspNetCore.Mvc.Core (2)
ControllerBase.cs (1)
1870problemDetails = new ProblemDetails
Infrastructure\DefaultProblemDetailsFactory.cs (1)
48var problemDetails = new ProblemDetails
Microsoft.AspNetCore.Mvc.Core.Test (13)
ActionResultOfTTest.cs (1)
81var value = new ProblemDetails { Status = StatusCodes.Status400BadRequest };
Infrastructure\DefaultApiProblemDetailsWriterTest.cs (4)
26var expectedProblem = new ProblemDetails() 61var originalProblemDetails = new ProblemDetails(); 63var expectedProblem = new ProblemDetails() 100var expectedProblem = new ProblemDetails();
Infrastructure\ObjectResultExecutorTest.cs (6)
122var result = new ObjectResult(new ProblemDetails()) 147var result = new ObjectResult(new ProblemDetails()); 169var result = new ObjectResult(new ProblemDetails()); 192var result = new ObjectResult(new ProblemDetails()) 217var result = new ObjectResult(new ProblemDetails()) 241var result = new ObjectResult(new ProblemDetails());
ObjectResultTests.cs (2)
98var details = new ProblemDetails { Status = StatusCodes.Status413RequestEntityTooLarge, }; 129var details = new ProblemDetails { Status = StatusCodes.Status422UnprocessableEntity, };
Microsoft.AspNetCore.Mvc.Formatters.Xml (1)
ProblemDetailsWrapper.cs (1)
28: this(new ProblemDetails())
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (2)
ProblemDetailsWrapperProviderFactoryTest.cs (1)
27var instance = new ProblemDetails();
ProblemDetailsWrapperTest.cs (1)
60var problemDetails = new ProblemDetails
Microsoft.AspNetCore.Mvc.NewtonsoftJson (1)
ProblemDetailsConverter.cs (1)
28var problemDetails = (ProblemDetails?)existingValue ?? new ProblemDetails();
MinimalSample (1)
Program.cs (1)
86"object" => Results.Problem(new ProblemDetails() { Status = 500, Extensions = { { "traceId", "traceId123" } } }),
XmlFormattersWebSite (1)
Controllers\XmlApiControllerBase.cs (1)
20return NotFound(new ProblemDetails
330 references to ProblemDetails
Diagnostics.FunctionalTests (10)
DeveloperExceptionPageSampleTest.cs (2)
48var body = await response.Content.ReadFromJsonAsync<ProblemDetails>();
ProblemDetailsExceptionHandlerSampleTest.cs (4)
33var body = await response.Content.ReadFromJsonAsync<ProblemDetails>(); 50var body = await response.Content.ReadFromJsonAsync<ProblemDetails>();
StatusCodeSampleTest.cs (4)
88var body = await response.Content.ReadFromJsonAsync<ProblemDetails>(); 105var body = await response.Content.ReadFromJsonAsync<ProblemDetails>();
FormatterWebSite (1)
Controllers\JsonOutputFormatterController.cs (1)
63public ActionResult<ProblemDetails> ProblemDetailsResult() => NotFound();
Microsoft.AspNetCore.Diagnostics (2)
DeveloperExceptionPage\DeveloperExceptionPageMiddlewareImpl.cs (2)
251private ProblemDetails CreateProblemDetails(ErrorContext errorContext, HttpContext httpContext) 253var problemDetails = new ProblemDetails
Microsoft.AspNetCore.Diagnostics.Tests (8)
DeveloperExceptionPageMiddlewareTest.cs (6)
69var body = await response.Content.ReadFromJsonAsync<ProblemDetails>(); 122var body = await response.Content.ReadFromJsonAsync<ProblemDetails>(); 181var body = await response.Content.ReadFromJsonAsync<ProblemDetails>();
ExceptionHandlerMiddlewareTest.cs (2)
75var body = await response.Content.ReadFromJsonAsync<ProblemDetails>();
Microsoft.AspNetCore.Http.Abstractions (10)
ProblemDetails\HttpValidationProblemDetails.cs (1)
10/// A <see cref="ProblemDetails"/> for validation errors.
ProblemDetails\IProblemDetailsService.cs (3)
8/// create a <see cref="Mvc.ProblemDetails"/> response. 13/// Write a <see cref="Mvc.ProblemDetails"/> response to the current context, 28/// Try to write a <see cref="Mvc.ProblemDetails"/> response to the current context,
ProblemDetails\IProblemDetailsWriter.cs (3)
7/// Defines a type that write a <see cref="Mvc.ProblemDetails"/> 13/// Write a <see cref="Mvc.ProblemDetails"/> response to the current context 19/// Determines whether this instance can write a <see cref="Mvc.ProblemDetails"/> to the current context.
ProblemDetails\ProblemDetailsContext.cs (3)
13private ProblemDetails? _problemDetails; 26/// An instance of <see cref="ProblemDetails"/> that will be 29public ProblemDetails ProblemDetails
Microsoft.AspNetCore.Http.Abstractions.Tests (13)
ProblemDetailsContextTests.cs (1)
16ProblemDetails problemDetails = new();
ProblemDetailsJsonConverterTest.cs (12)
26JsonSerializer.Deserialize(ref reader, typeof(ProblemDetails), JsonSerializerOptions); 46var problemDetails = JsonSerializer.Deserialize<ProblemDetails>(ref reader, JsonSerializerOptions); 77var problemDetails = JsonSerializer.Deserialize<ProblemDetails>(json, JsonSerializerOptions); 109var problemDetails = JsonSerializer.Deserialize<ProblemDetails>(json, serializerOptions); 141var problemDetails = JsonSerializer.Deserialize<ProblemDetails>(ref reader, JsonSerializerOptions); 162var value = new ProblemDetails 193var value = new ProblemDetails 217var value = new ProblemDetails
Microsoft.AspNetCore.Http.Extensions (6)
ProblemDetailsJsonContext.cs (1)
10[JsonSerializable(typeof(ProblemDetails))]
ProblemDetailsOptions.cs (1)
13/// The operation that customizes the current <see cref="Mvc.ProblemDetails"/> instance.
ProblemDetailsServiceCollectionExtensions.cs (2)
18/// Adds services required for creation of <see cref="ProblemDetails"/> for failed requests. 29/// Adds services required for creation of <see cref="ProblemDetails"/> for failed requests.
Properties\AssemblyInfo.cs (1)
6[assembly: TypeForwardedTo(typeof(Microsoft.AspNetCore.Mvc.ProblemDetails))]
src\Shared\ProblemDetails\ProblemDetailsDefaults.cs (1)
170public static void Apply(ProblemDetails problemDetails, int? statusCode)
Microsoft.AspNetCore.Http.Extensions.Tests (34)
ProblemDetailsDefaultWriterTest.cs (26)
30var expectedProblem = new ProblemDetails() 49var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, SerializerOptions); 67var expectedProblem = new ProblemDetails() 130var originalProblemDetails = new ProblemDetails(); 133var expectedProblem = new ProblemDetails() 154var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, SerializerOptions); 175var expectedProblem = new ProblemDetails() 194var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, SerializerOptions); 215var expectedProblem = new ProblemDetails() 234var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, SerializerOptions); 463var expectedProblem = new ProblemDetails(); 479var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, SerializerOptions); 509var expectedProblem = new ProblemDetails(); 526var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, options.SerializerOptions); 559var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, SerializerOptions); 595var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, SerializerOptions); 627var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, SerializerOptions);
ProblemDetailsServiceCollectionExtensionsTest.cs (7)
102Assert.NotNull(jsonOptions.Value.SerializerOptions.TypeInfoResolver.GetTypeInfo(typeof(ProblemDetails), jsonOptions.Value.SerializerOptions)); 167Assert.NotNull(jsonOptions.Value.SerializerOptions.TypeInfoResolver.GetTypeInfo(typeof(ProblemDetails), jsonOptions.Value.SerializerOptions)); 188Assert.NotNull(jsonOptions.Value.SerializerOptions.TypeInfoResolver.GetTypeInfo(typeof(ProblemDetails), jsonOptions.Value.SerializerOptions)); 209Assert.NotNull(jsonOptions.Value.SerializerOptions.TypeInfoResolver.GetTypeInfo(typeof(ProblemDetails), jsonOptions.Value.SerializerOptions)); 239var pdTypeInfo = jsonOptions.Value.SerializerOptions.GetTypeInfo(typeof(ProblemDetails)); 255if (type == typeof(ProblemDetails)) 257LastProblemDetailsInfo = JsonTypeInfo.CreateJsonTypeInfo<ProblemDetails>(options);
RequestDelegateGenerator\RequestDelegateCreationTests.Filters.cs (1)
103await VerifyResponseJsonBodyAsync<ProblemDetails>(httpContext, (problemDetails) =>
Microsoft.AspNetCore.Http.Results (65)
HttpResultsHelper.cs (1)
144if (value is ProblemDetails problemDetails)
JsonHttpResultOfT.cs (2)
32if (value is ProblemDetails problemDetails) 52if (value is ProblemDetails problemDetails)
ProblemHttpResult.cs (5)
14public sealed class ProblemHttpResult : IResult, IStatusCodeHttpResult, IContentTypeHttpResult, IValueHttpResult, IValueHttpResult<ProblemDetails> 21internal ProblemHttpResult(ProblemDetails problemDetails) 30public ProblemDetails ProblemDetails { get; } 34ProblemDetails? IValueHttpResult<ProblemDetails>.Value => ProblemDetails;
Results.cs (27)
705/// Produces a <see cref="ProblemDetails"/> response. 707/// <param name="statusCode">The value for <see cref="ProblemDetails.Status" />.</param> 708/// <param name="detail">The value for <see cref="ProblemDetails.Detail" />.</param> 709/// <param name="instance">The value for <see cref="ProblemDetails.Instance" />.</param> 710/// <param name="title">The value for <see cref="ProblemDetails.Title" />.</param> 711/// <param name="type">The value for <see cref="ProblemDetails.Type" />.</param> 712/// <param name="extensions">The value for <see cref="ProblemDetails.Extensions" />.</param> 724/// Produces a <see cref="ProblemDetails"/> response. 726/// <param name="statusCode">The value for <see cref="ProblemDetails.Status" />.</param> 727/// <param name="detail">The value for <see cref="ProblemDetails.Detail" />.</param> 728/// <param name="instance">The value for <see cref="ProblemDetails.Instance" />.</param> 729/// <param name="title">The value for <see cref="ProblemDetails.Title" />.</param> 730/// <param name="type">The value for <see cref="ProblemDetails.Type" />.</param> 731/// <param name="extensions">The value for <see cref="ProblemDetails.Extensions" />.</param> 745/// Produces a <see cref="ProblemDetails"/> response. 747/// <param name="problemDetails">The <see cref="ProblemDetails"/> object to produce a response from.</param> 749public static IResult Problem(ProblemDetails problemDetails) 757/// <param name="detail">The value for <see cref="ProblemDetails.Detail" />.</param> 758/// <param name="instance">The value for <see cref="ProblemDetails.Instance" />.</param> 760/// <param name="title">The value for <see cref="ProblemDetails.Title" />. Defaults to "One or more validation errors occurred."</param> 761/// <param name="type">The value for <see cref="ProblemDetails.Type" />.</param> 762/// <param name="extensions">The value for <see cref="ProblemDetails.Extensions" />.</param> 781/// <param name="detail">The value for <see cref="ProblemDetails.Detail" />.</param> 782/// <param name="instance">The value for <see cref="ProblemDetails.Instance" />.</param> 784/// <param name="title">The value for <see cref="ProblemDetails.Title" />. Defaults to "One or more validation errors occurred."</param> 785/// <param name="type">The value for <see cref="ProblemDetails.Type" />.</param> 786/// <param name="extensions">The value for <see cref="ProblemDetails.Extensions" />.</param>
src\Shared\ProblemDetails\ProblemDetailsDefaults.cs (1)
170public static void Apply(ProblemDetails problemDetails, int? statusCode)
TypedResults.cs (29)
748/// Produces a <see cref="ProblemDetails"/> response. 750/// <param name="statusCode">The value for <see cref="ProblemDetails.Status" />.</param> 751/// <param name="detail">The value for <see cref="ProblemDetails.Detail" />.</param> 752/// <param name="instance">The value for <see cref="ProblemDetails.Instance" />.</param> 753/// <param name="title">The value for <see cref="ProblemDetails.Title" />.</param> 754/// <param name="type">The value for <see cref="ProblemDetails.Type" />.</param> 755/// <param name="extensions">The value for <see cref="ProblemDetails.Extensions" />.</param> 769/// Produces a <see cref="ProblemDetails"/> response. 771/// <param name="statusCode">The value for <see cref="ProblemDetails.Status" />.</param> 772/// <param name="detail">The value for <see cref="ProblemDetails.Detail" />.</param> 773/// <param name="instance">The value for <see cref="ProblemDetails.Instance" />.</param> 774/// <param name="title">The value for <see cref="ProblemDetails.Title" />.</param> 775/// <param name="type">The value for <see cref="ProblemDetails.Type" />.</param> 776/// <param name="extensions">The value for <see cref="ProblemDetails.Extensions" />.</param> 788var problemDetails = new ProblemDetails 803/// Produces a <see cref="ProblemDetails"/> response. 805/// <param name="problemDetails">The <see cref="ProblemDetails"/> object to produce a response from.</param> 807public static ProblemHttpResult Problem(ProblemDetails problemDetails) 818/// <param name="detail">The value for <see cref="ProblemDetails.Detail" />.</param> 819/// <param name="instance">The value for <see cref="ProblemDetails.Instance" />.</param> 820/// <param name="title">The value for <see cref="ProblemDetails.Title" />. Defaults to "One or more validation errors occurred."</param> 821/// <param name="type">The value for <see cref="ProblemDetails.Type" />.</param> 822/// <param name="extensions">The value for <see cref="ProblemDetails.Extensions" />.</param> 839/// <param name="detail">The value for <see cref="ProblemDetails.Detail" />.</param> 840/// <param name="instance">The value for <see cref="ProblemDetails.Instance" />.</param> 841/// <param name="title">The value for <see cref="ProblemDetails.Title" />. Defaults to "One or more validation errors occurred."</param> 842/// <param name="type">The value for <see cref="ProblemDetails.Type" />.</param> 843/// <param name="extensions">The value for <see cref="ProblemDetails.Extensions" />.</param> 871private static void CopyExtensions(IEnumerable<KeyValuePair<string, object?>>? extensions, ProblemDetails problemDetails)
Microsoft.AspNetCore.Http.Results.Tests (34)
BadRequestOfTResultTests.cs (2)
88var details = new ProblemDetails { Status = StatusCodes.Status422UnprocessableEntity, }; 89var result = new BadRequest<ProblemDetails>(details);
ConflictOfTResultTests.cs (2)
35var obj = new ProblemDetails(); 36var conflictObjectResult = new Conflict<ProblemDetails>(obj);
InternalServerErrorOfTResultTests.cs (2)
88var details = new ProblemDetails { Status = StatusCodes.Status422UnprocessableEntity, }; 89var result = new InternalServerError<ProblemDetails>(details);
JsonResultTests.cs (7)
116var details = new ProblemDetails(); 118var result = new JsonHttpResult<ProblemDetails>(details, jsonSerializerOptions: JsonSerializerOptions.Web); 135var responseDetails = JsonSerializer.Deserialize<ProblemDetails>(stream, JsonSerializerOptions.Web); 174var details = new ProblemDetails() 225var details = new ProblemDetails { Status = StatusCodes.Status413RequestEntityTooLarge, }; 227var result = new JsonHttpResult<ProblemDetails>(details, jsonSerializerOptions: null);
ProblemResultTests.cs (13)
19var details = new ProblemDetails(); 38var responseDetails = JsonSerializer.Deserialize<ProblemDetails>(stream, JsonSerializerOptions.Web); 48var details = new ProblemDetails(); 70var responseDetails = JsonSerializer.Deserialize<ProblemDetails>(stream, JsonSerializerOptions.Web); 109var details = new ProblemDetails() 173var details = new ProblemDetails { Status = StatusCodes.Status413RequestEntityTooLarge, }; 222var value = new ProblemDetails(); 226Assert.IsType<ProblemDetails>(result.Value); 234var value = new ProblemDetails(); 237var result = Assert.IsAssignableFrom<IValueHttpResult<ProblemDetails>>(new ProblemHttpResult(value)); 238Assert.IsType<ProblemDetails>(result.Value);
ResultsTests.cs (2)
1244Assert.Throws<ArgumentNullException>("problemDetails", () => Results.Problem(default(ProblemDetails))); 1361var problem = new ProblemDetails { Title = "Test title" };
TypedResultsTests.cs (2)
1060Assert.Throws<ArgumentNullException>("problemDetails", () => TypedResults.Problem(default(ProblemDetails))); 1153var problem = new ProblemDetails { Title = "Test title" };
ValidationProblemResultTests.cs (4)
42var responseDetails = JsonSerializer.Deserialize<ProblemDetails>(stream, JsonSerializerOptions.Web); 74var responseDetails = JsonSerializer.Deserialize<ProblemDetails>(stream, JsonSerializerOptions.Web);
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (13)
ApiResponseTypeProviderTest.cs (10)
83new FilterDescriptor(new ProducesResponseTypeAttribute(typeof(ProblemDetails), 400), FilterScope.Controller), 118Assert.Equal(typeof(ProblemDetails), responseType.Type); 381var errorType = typeof(ProblemDetails); 577actionDescriptor.Properties[typeof(ProducesErrorResponseTypeAttribute)] = new ProducesErrorResponseTypeAttribute(typeof(ProblemDetails)); 590Assert.Equal(typeof(ProblemDetails), responseType.Type); 607Assert.Equal(typeof(ProblemDetails), responseType.Type); 627actionDescriptor.Properties[typeof(ProducesErrorResponseTypeAttribute)] = new ProducesErrorResponseTypeAttribute(typeof(ProblemDetails)); 657actionDescriptor.Properties[typeof(ProducesErrorResponseTypeAttribute)] = new ProducesErrorResponseTypeAttribute(typeof(ProblemDetails)); 715actionDescriptor.FilterDescriptors.Add(new FilterDescriptor(new ProducesResponseTypeAttribute(typeof(ProblemDetails), 404, "application/problem+json"), FilterScope.Action)); 741Assert.Equal(typeof(ProblemDetails), responseType.Type);
EndpointMetadataApiDescriptionProviderTest.cs (3)
850Assert.Contains(apiDescription.SupportedResponseTypes, m => m is { StatusCode: 400, Type: { } type } && type == typeof(ProblemDetails)); 942Assert.Equal(typeof(ProblemDetails), responseType.Type); 948Assert.Equal(typeof(ProblemDetails), responseType.Type);
Microsoft.AspNetCore.Mvc.Core (55)
ActionResultOfT.cs (1)
86if (Value is ProblemDetails problemDetails && problemDetails.Status != null)
ApiBehaviorOptions.cs (2)
72/// <see cref="ProblemDetails"/> instance (returned as the value for <see cref="ObjectResult"/>). 87/// instance where the <see cref="ObjectResult.Value"/> is <see cref="ProblemDetails"/>.
ApplicationModels\ApiBehaviorApplicationModelProvider.cs (1)
43var defaultErrorType = options.SuppressMapClientErrors ? typeof(void) : typeof(ProblemDetails);
ClientErrorData.cs (2)
16/// By default, this maps to <see cref="ProblemDetails.Type"/>. 24/// By default, this maps to <see cref="ProblemDetails.Title"/> and should not change
ControllerBase.cs (23)
1829/// Creates an <see cref="ObjectResult"/> that produces a <see cref="ProblemDetails"/> response. 1831/// <param name="statusCode">The value for <see cref="ProblemDetails.Status" />.</param> 1832/// <param name="detail">The value for <see cref="ProblemDetails.Detail" />.</param> 1833/// <param name="instance">The value for <see cref="ProblemDetails.Instance" />.</param> 1834/// <param name="title">The value for <see cref="ProblemDetails.Title" />.</param> 1835/// <param name="type">The value for <see cref="ProblemDetails.Type" />.</param> 1848/// Creates an <see cref="ObjectResult"/> that produces a <see cref="ProblemDetails"/> response. 1850/// <param name="statusCode">The value for <see cref="ProblemDetails.Status" />.</param> 1851/// <param name="detail">The value for <see cref="ProblemDetails.Detail" />.</param> 1852/// <param name="instance">The value for <see cref="ProblemDetails.Instance" />.</param> 1853/// <param name="title">The value for <see cref="ProblemDetails.Title" />.</param> 1854/// <param name="type">The value for <see cref="ProblemDetails.Type" />.</param> 1855/// <param name="extensions">The value for <see cref="ProblemDetails.Extensions" />.</param> 1866ProblemDetails problemDetails; 1942/// <param name="detail">The value for <see cref="ProblemDetails.Detail" />.</param> 1943/// <param name="instance">The value for <see cref="ProblemDetails.Instance" />.</param> 1945/// <param name="title">The value for <see cref="ProblemDetails.Title" />.</param> 1946/// <param name="type">The value for <see cref="ProblemDetails.Type" />.</param> 1966/// <param name="detail">The value for <see cref="ProblemDetails.Detail" />.</param> 1967/// <param name="instance">The value for <see cref="ProblemDetails.Instance" />.</param> 1969/// <param name="title">The value for <see cref="ProblemDetails.Title" />.</param> 1970/// <param name="type">The value for <see cref="ProblemDetails.Type" />.</param> 1973/// <param name="extensions">The value for <see cref="ProblemDetails.Extensions" />.</param>
Infrastructure\DefaultApiProblemDetailsWriter.cs (2)
56var problemDetails = _problemDetailsFactory.CreateProblemDetails( 75typeof(ProblemDetails),
Infrastructure\DefaultProblemDetailsFactory.cs (3)
38public override ProblemDetails CreateProblemDetails( 48var problemDetails = new ProblemDetails 95private void ApplyProblemDetailsDefaults(HttpContext httpContext, ProblemDetails problemDetails, int statusCode)
Infrastructure\ObjectResultExecutor.cs (1)
134if (result.Value is ProblemDetails)
Infrastructure\ProblemDetailsClientErrorFactory.cs (1)
17var problemDetails = _problemDetailsFactory.CreateProblemDetails(actionContext.HttpContext, clientError.StatusCode);
Infrastructure\ProblemDetailsFactory.cs (14)
10/// Factory to produce <see cref="ProblemDetails" /> and <see cref="ValidationProblemDetails" />. 15/// Creates a <see cref="ProblemDetails" /> instance that configures defaults based on values specified in <see cref="ApiBehaviorOptions" />. 18/// <param name="statusCode">The value for <see cref="ProblemDetails.Status"/>.</param> 19/// <param name="title">The value for <see cref="ProblemDetails.Title" />.</param> 20/// <param name="type">The value for <see cref="ProblemDetails.Type" />.</param> 21/// <param name="detail">The value for <see cref="ProblemDetails.Detail" />.</param> 22/// <param name="instance">The value for <see cref="ProblemDetails.Instance" />.</param> 23/// <returns>The <see cref="ProblemDetails"/> instance.</returns> 24public abstract ProblemDetails CreateProblemDetails( 37/// <param name="statusCode">The value for <see cref="ProblemDetails.Status"/>.</param> 38/// <param name="title">The value for <see cref="ProblemDetails.Title" />.</param> 39/// <param name="type">The value for <see cref="ProblemDetails.Type" />.</param> 40/// <param name="detail">The value for <see cref="ProblemDetails.Detail" />.</param> 41/// <param name="instance">The value for <see cref="ProblemDetails.Instance" />.</param>
ObjectResult.cs (1)
73if (Value is ProblemDetails details)
ProducesErrorResponseTypeAttribute.cs (1)
11/// client error type to be <see cref="ProblemDetails"/>, if mapping client errors (<see cref="ApiBehaviorOptions.ClientErrorMapping"/>)
Properties\AssemblyInfo.cs (1)
9[assembly: TypeForwardedTo(typeof(ProblemDetails))]
src\Shared\ProblemDetails\ProblemDetailsDefaults.cs (1)
170public static void Apply(ProblemDetails problemDetails, int? statusCode)
ValidationProblemDetails.cs (1)
12/// A <see cref="ProblemDetails"/> for validation errors.
Microsoft.AspNetCore.Mvc.Core.Test (36)
ActionResultOfTTest.cs (3)
81var value = new ProblemDetails { Status = StatusCodes.Status400BadRequest }; 82var actionResultOfT = new ActionResult<ProblemDetails>(value); 91Assert.Equal(typeof(ProblemDetails), objectResult.DeclaredType);
ApplicationModels\ApiBehaviorApplicationModelProviderTest.cs (1)
142Assert.Equal(typeof(ProblemDetails), convention.DefaultErrorResponseType.Type);
ApplicationModels\ApiConventionApplicationModelConventionTest.cs (1)
152errorType = errorType ?? typeof(ProblemDetails);
ControllerBaseTest.cs (8)
2475var problemDetails = Assert.IsType<ProblemDetails>(badRequestResult.Value); 2501var problemDetails = Assert.IsType<ProblemDetails>(badRequestResult.Value); 2525var problemDetails = Assert.IsType<ProblemDetails>(badRequestResult.Value); 2546var problemDetails = Assert.IsType<ProblemDetails>(badRequestResult.Value);
Infrastructure\DefaultApiProblemDetailsWriterTest.cs (10)
26var expectedProblem = new ProblemDetails() 45var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, JsonSerializerOptions.Web); 61var originalProblemDetails = new ProblemDetails(); 63var expectedProblem = new ProblemDetails() 84var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, JsonSerializerOptions.Web); 100var expectedProblem = new ProblemDetails(); 115var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream);
Infrastructure\ProblemDetailsFactoryTest.cs (3)
19var problemDetails = Factory.CreateProblemDetails(GetHttpContext()); 40var problemDetails = Factory.CreateProblemDetails(GetHttpContext(), statusCode: 406); 63var problemDetails = Factory.CreateProblemDetails(GetHttpContext(), statusCode: 406, title: title, detail: detail);
Infrastructure\ProblemDetalsClientErrorFactoryTest.cs (8)
32var problemDetails = Assert.IsType<ProblemDetails>(objectResult.Value); 59var problemDetails = Assert.IsType<ProblemDetails>(objectResult.Value); 89var problemDetails = Assert.IsType<ProblemDetails>(objectResult.Value); 115var problemDetails = Assert.IsType<ProblemDetails>(objectResult.Value);
ObjectResultTests.cs (2)
98var details = new ProblemDetails { Status = StatusCodes.Status413RequestEntityTooLarge, }; 129var details = new ProblemDetails { Status = StatusCodes.Status422UnprocessableEntity, };
Microsoft.AspNetCore.Mvc.Formatters.Xml (5)
ProblemDetailsWrapper.cs (3)
12/// Wrapper class for <see cref="Mvc.ProblemDetails"/> to enable it to be serialized by the xml formatters. 35public ProblemDetailsWrapper(ProblemDetails problemDetails) 40internal ProblemDetails ProblemDetails { get; }
ProblemDetailsWrapperProviderFactory.cs (2)
10if (context.DeclaredType == typeof(ProblemDetails)) 12return new WrapperProvider(typeof(ProblemDetailsWrapper), p => new ProblemDetailsWrapper((ProblemDetails)p!));
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (3)
ProblemDetailsWrapperProviderFactoryTest.cs (1)
27var instance = new ProblemDetails();
ProblemDetailsWrapperTest.cs (2)
32var problemDetails = Assert.IsType<ProblemDetailsWrapper>(value).ProblemDetails; 60var problemDetails = new ProblemDetails
Microsoft.AspNetCore.Mvc.FunctionalTests (14)
ApiBehaviorTest.cs (4)
130var problemDetails = JsonConvert.DeserializeObject<ProblemDetails>(content); 300var problemDetails = JsonConvert.DeserializeObject<ProblemDetails>(
ApiExplorerTest.cs (10)
1288Assert.Equal(typeof(ProblemDetails).FullName, responseType.ResponseType); 1344Assert.Equal(typeof(ProblemDetails).FullName, responseType.ResponseType); 1379Assert.Equal(typeof(ProblemDetails).FullName, responseType.ResponseType); 1414Assert.Equal(typeof(ProblemDetails).FullName, responseType.ResponseType); 1449Assert.Equal(typeof(ProblemDetails).FullName, responseType.ResponseType); 1455Assert.Equal(typeof(ProblemDetails).FullName, responseType.ResponseType); 1489Assert.Equal(typeof(ProblemDetails).FullName, responseType.ResponseType); 1495Assert.Equal(typeof(ProblemDetails).FullName, responseType.ResponseType); 1526Assert.Equal(typeof(ProblemDetails).FullName, responseType.ResponseType); 1533[InlineData("ActionWithNoExplicitType", typeof(ProblemDetails))]
Microsoft.AspNetCore.Mvc.NewtonsoftJson (8)
AnnotatedProblemDetails.cs (2)
15public AnnotatedProblemDetails(ProblemDetails problemDetails) 47public void CopyTo(ProblemDetails problemDetails)
ProblemDetailsConverter.cs (6)
9/// A RFC 7807 compliant <see cref="JsonConverter"/> for <see cref="ProblemDetails"/>. 16return objectType == typeof(ProblemDetails); 28var problemDetails = (ProblemDetails?)existingValue ?? new ProblemDetails(); 43var problemDetails = (ProblemDetails)value;
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (2)
ControllerUnitTestabilityTests.cs (2)
694var problemDetails = Assert.IsType<ProblemDetails>(badRequest.Value);
Microsoft.AspNetCore.OpenApi.Tests (5)
Extensions\JsonTypeInfoExtensionsTests.cs (1)
57[typeof(ProblemDetails), "ProblemDetails"],
Services\OpenApiDocumentService\OpenApiDocumentServiceTests.Responses.cs (1)
50.WithMetadata(new ProducesResponseTypeMetadata(StatusCodes.Status400BadRequest, typeof(ProblemDetails), ["application/json+problem"]));
Services\OpenApiGeneratorTests.cs (3)
540new ProducesResponseTypeMetadata(StatusCodes.Status400BadRequest, typeof(ProblemDetails), new [] { "application/json+problem" }) 589new ProducesResponseTypeMetadata(StatusCodes.Status404NotFound, typeof(ProblemDetails), new[] { "application/problem+json" }), 590new ProducesResponseTypeMetadata(StatusCodes.Status409Conflict, typeof(ProblemDetails), new[] { "application/problem+json" })
Microsoft.AspNetCore.Routing (4)
Builder\OpenApiRouteHandlerBuilderExtensions.cs (4)
95/// Adds an <see cref="IProducesResponseTypeMetadata"/> with a <see cref="ProblemDetails"/> type 109return Produces(builder, statusCode, typeof(ProblemDetails), contentType); 113/// Adds an <see cref="IProducesResponseTypeMetadata"/> with a <see cref="ProblemDetails"/> type 130return builder.WithMetadata(new ProducesResponseTypeMetadata(statusCode, typeof(ProblemDetails), [contentType]));
Microsoft.AspNetCore.Routing.Tests (1)
Builder\OpenApiRouteHandlerBuilderExtensionsTest.cs (1)
80Assert.Equal(typeof(ProblemDetails), metadata.Type);
Mvc.Api.Analyzers.Test (1)
SymbolApiResponseMetadataProviderTest.cs (1)
405var expected = compilation.GetTypeByMetadataName(typeof(ProblemDetails).FullName);