1 write to Exception
Microsoft.AspNetCore.Mvc.Abstractions (1)
ModelBinding\ModelError.cs (1)
29Exception = exception ?? throw new ArgumentNullException(nameof(exception));
106 references to Exception
Microsoft.AspNetCore.Mvc.Abstractions (4)
ModelBinding\Metadata\ModelBindingMessageProvider.cs (4)
42/// Error message the model binding system adds when <see cref="ModelError.Exception"/> is of type 50/// Error message the model binding system adds when <see cref="ModelError.Exception"/> is of type 58/// Error message the model binding system adds when <see cref="ModelError.Exception"/> is of type 66/// Error message the model binding system adds when <see cref="ModelError.Exception"/> is of type
Microsoft.AspNetCore.Mvc.Abstractions.Test (17)
ModelBinding\ModelStateDictionaryTest.cs (17)
299Assert.Same(exception, error.Exception); 339Assert.Same(exception, kvp.Value.Errors[1].Exception); 770Assert.IsType<TooManyModelErrorsException>(error.Exception); 771Assert.Equal(expected, error.Exception.Message); 799Assert.IsType<TooManyModelErrorsException>(error.Exception); 800Assert.Equal(expected, error.Exception.Message); 840Assert.IsType<TooManyModelErrorsException>(error.Exception); 841Assert.Equal(expected, error.Exception.Message); 871Assert.IsType<TooManyModelErrorsException>(error.Exception); 872Assert.Equal(expected, error.Exception.Message); 876Assert.Null(error.Exception); 904Assert.IsType<TooManyModelErrorsException>(error.Exception); 905Assert.Equal(expected, error.Exception.Message); 930Assert.IsType<TooManyModelErrorsException>(error.Exception); 931Assert.Equal(expected, error.Exception.Message); 970Assert.Same(exception, error.Exception); 1083Assert.Same(exception, error.Exception);
Microsoft.AspNetCore.Mvc.Core (1)
ModelBinding\UnsupportedContentTypeFilter.cs (1)
49if (error.Exception is UnsupportedContentTypeException)
Microsoft.AspNetCore.Mvc.Core.Test (38)
Formatters\JsonInputFormatterTestBase.cs (1)
436Assert.IsType<TooManyModelErrorsException>(error.Exception);
Formatters\SystemTextJsonInputFormatterTest.cs (1)
180Assert.IsNotType<InputFormatterException>(modelError.Exception);
Formatters\TextInputFormatterTest.cs (1)
38Assert.IsType<UnsupportedContentTypeException>(error.Exception);
ModelBinding\Binders\BodyModelBinderTests.cs (8)
244Assert.Equal("Unsupported content type ''.", bindingContext.ModelState[bindingContext.BinderModelName].Errors[0].Exception.Message); 279Assert.Null(entry.Value.Errors[0].Exception); 322Assert.Null(entry.Value.Errors[0].Exception); 393Assert.Null(entry.Value.Errors[0].Exception); 423Assert.Null(entry.Value.Errors[0].Exception); 502var errorMessage = Assert.Single(entry.Value.Errors).Exception.Message; 504Assert.IsType<IOException>(entry.Value.Errors[0].Exception); 558var errorMessage = Assert.Single(entry.Value.Errors).Exception.Message;
ModelBinding\Binders\ComplexObjectModelBinderTest.cs (5)
622Assert.Null(modelError.Exception); 687Assert.Null(modelError.Exception); 729Assert.IsType<NullReferenceException>(modelError.Exception); 1058bindingContext.ModelState["foo"].Errors[0].Exception.Message); 1081bindingContext.ModelState["foo.NameNoAttribute"].Errors[0].Exception.Message);
ModelBinding\Binders\ComplexTypeModelBinderTest.cs (5)
800Assert.Null(modelError.Exception); 834Assert.Null(modelError.Exception); 873Assert.IsType<NullReferenceException>(modelError.Exception); 1220bindingContext.ModelState["foo"].Errors[0].Exception.Message); 1243bindingContext.ModelState["foo.NameNoAttribute"].Errors[0].Exception.Message);
ModelBinding\Binders\DateTimeModelBinderTest.cs (2)
73Assert.Null(error.Exception); 129Assert.Null(error.Exception);
ModelBinding\Binders\FloatingPointTypeModelBinderTestOfT.cs (5)
96Assert.Null(error.Exception); 120Assert.Null(error.Exception); 144Assert.Null(error.Exception); 168Assert.Null(error.Exception); 210Assert.Null(error.Exception);
ModelBinding\Binders\SimpleTypeModelBinderTest.cs (3)
131Assert.Null(error.Exception); 332Assert.Null(error.Exception); 377Assert.Null(error.Exception);
ModelBinding\Binders\TryParseTypeModelBinderTest.cs (5)
80Assert.Null(error.Exception); 258Assert.Null(error.Exception); 303Assert.Null(error.Exception); 408Assert.Null(error.Exception); 458Assert.Null(error.Exception);
ModelBinding\Validation\DefaultObjectValidatorTests.cs (2)
745Assert.IsType<TooManyModelErrorsException>(error.Exception); 1250Assert.IsType<TooManyModelErrorsException>(error.Exception);
Microsoft.AspNetCore.Mvc.IntegrationTests (29)
BodyValidationIntegrationTests.cs (1)
594Assert.IsType<JsonReaderException>(error.Exception);
ComplexRecordIntegrationTest.cs (2)
2571Assert.Null(error.Exception); 2621Assert.Null(error.Exception);
ComplexTypeIntegrationTestBase.cs (2)
2744Assert.Null(error.Exception); 2794Assert.Null(error.Exception);
KeyValuePairModelBinderIntegrationTest.cs (4)
81Assert.Null(error.Exception); 131Assert.Null(error.Exception); 173Assert.Null(error.Exception); 223Assert.Null(error.Exception);
SimpleTypeModelBinderIntegrationTest.cs (4)
405Assert.Null(error.Exception); 465Assert.Null(error.Exception); 508Assert.Null(error.Exception); 562Assert.Null(error.Exception);
ValidationIntegrationTests.cs (8)
753Assert.Null(error.Exception); 841Assert.Null(error.Exception); 980Assert.Null(error.Exception); 1088Assert.Null(error.Exception); 1171Assert.Null(error.Exception); 1384Assert.Null(error.Exception); 1431Assert.Null(error.Exception); 2573Assert.Null(error.Exception);
ValidationWithRecordIntegrationTests.cs (8)
636Assert.Null(error.Exception); 717Assert.Null(error.Exception); 849Assert.Null(error.Exception); 950Assert.Null(error.Exception); 1029Assert.Null(error.Exception); 1228Assert.Null(error.Exception); 1275Assert.Null(error.Exception); 2459Assert.Null(error.Exception);
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (6)
NewtonsoftJsonInputFormatterTest.cs (5)
306Assert.IsNotType<InputFormatterException>(modelError.Exception); 339Assert.Null(modelError.Exception); 370Assert.Null(modelError.Exception); 401Assert.Null(modelError.Exception); 432Assert.Null(modelError.Exception);
src\Mvc\Mvc.Core\test\Formatters\JsonInputFormatterTestBase.cs (1)
436Assert.IsType<TooManyModelErrorsException>(error.Exception);
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (8)
ModelStateDictionaryExtensionsTest.cs (8)
92Assert.Same(exception, modelError.Exception); 112Assert.Same(exception, modelError.Exception); 130Assert.Same(exception, modelError.Exception); 150Assert.Same(exception, modelError.Exception); 168Assert.Same(exception, modelError.Exception); 188Assert.Same(exception, modelError.Exception); 207Assert.Same(exception, modelError.Exception); 228Assert.Same(exception, modelError.Exception);
XmlFormattersWebSite (3)
Controllers\HomeController.cs (1)
40errors.Select(modelError => $"ErrorMessage:{modelError.ErrorMessage};Exception:{modelError.Exception}")));
Controllers\ValidationController.cs (2)
40if (modelError.Exception != null) 42errorMessage = modelError.Exception.Message;