4 instantiations of ModelError
Microsoft.AspNetCore.Mvc.Abstractions (2)
ModelBinding\ModelErrorCollection.cs (2)
21
Add(new
ModelError
(exception));
32
Add(new
ModelError
(errorMessage));
Microsoft.AspNetCore.Mvc.Abstractions.Test (2)
ModelBinding\ModelStateDictionaryTest.cs (2)
269
entry.Errors.Add(new
ModelError
(new InvalidOperationException()));
270
entry.Errors.Add(new
ModelError
("error-message"));
228 references to ModelError
Microsoft.AspNetCore.Mvc.Abstractions (13)
ModelBinding\Metadata\ModelBindingMessageProvider.cs (6)
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
75
/// <see cref="
ModelError
"/>s have <c>null</c> <see cref="
ModelError
.ErrorMessage"/>s.
ModelBinding\ModelError.cs (5)
12
/// Initializes a new instance of <see cref="
ModelError
"/> with the specified <paramref name="exception"/>.
21
/// Initializes a new instance of <see cref="
ModelError
"/> with the specified <paramref name="exception"/>
33
/// Initializes a new instance of <see cref="
ModelError
"/> with the specified <paramref name="errorMessage"/>.
42
/// Gets the <see cref="System.Exception"/> associated with this <see cref="
ModelError
"/> instance.
47
/// Gets the error message associated with this <see cref="
ModelError
"/> instance.
ModelBinding\ModelErrorCollection.cs (2)
9
/// A collection of <see cref="
ModelError
"/> instances.
11
public class ModelErrorCollection : Collection<
ModelError
>
Microsoft.AspNetCore.Mvc.Abstractions.Test (23)
ModelBinding\ModelStateDictionaryTest.cs (23)
298
var
error = Assert.Single(kvp.Value.Errors);
315
var
error = Assert.Single(kvp.Value.Errors);
769
var
error = Assert.Single(dictionary[string.Empty].Errors);
798
var
error = Assert.Single(dictionary[string.Empty].Errors);
839
var
error = Assert.Single(dictionary[string.Empty].Errors);
870
var
error = Assert.Single(dictionary[string.Empty].Errors);
903
var
error = Assert.Single(dictionary[string.Empty].Errors);
929
var
error = Assert.Single(copy[string.Empty].Errors);
969
var
error = Assert.Single(dictionary["key"].Errors);
986
var
error = Assert.Single(dictionary["key"].Errors);
1012
var
error = Assert.Single(entry.Value.Errors);
1040
var
error = Assert.Single(entry.Value.Errors);
1066
var
error = Assert.Single(entry.Value.Errors);
1082
var
error = Assert.Single(dictionary["key"].Errors);
1100
var
error = Assert.Single(dictionary["key"].Errors);
1127
var
error = Assert.Single(entry.Value.Errors);
1156
var
error = Assert.Single(entry.Value.Errors);
1183
var
error = Assert.Single(entry.Value.Errors);
1200
var
error = Assert.Single(dictionary["key"].Errors);
1218
var
error = Assert.Single(entry.Value.Errors);
1236
var
error = Assert.Single(entry.Value.Errors);
1256
var
error = Assert.Single(entry.Value.Errors);
1276
var
error = Assert.Single(entry.Value.Errors);
Microsoft.AspNetCore.Mvc.Core (3)
ModelBinding\Binders\CollectionModelBinder.cs (1)
205
/// Add a <see cref="
ModelError
" /> to <see cref="ModelBindingContext.ModelState" /> if
ModelBinding\UnsupportedContentTypeFilter.cs (1)
48
var
error = errors[i];
ValidationProblemDetails.cs (1)
65
static string GetErrorMessage(
ModelError
error)
Microsoft.AspNetCore.Mvc.Core.Test (82)
ControllerBaseTest.cs (3)
2711
var
error = Assert.Single(modelState.Value.Errors);
3117
var
error = Assert.Single(controller.ModelState["Prefix.IntegerProperty"].Errors);
3154
var
error = Assert.Single(controller.ModelState["IntegerProperty"].Errors);
Controllers\ControllerBinderDelegateProviderTest.cs (1)
1244
var
error = Assert.Single(entry.Value.Errors);
Formatters\JsonInputFormatterTestBase.cs (1)
435
var
error = Assert.Single(formatterContext.ModelState[""].Errors);
Formatters\SystemTextJsonInputFormatterTest.cs (5)
84
var
error = Assert.Single(kvp.Value.Errors);
106
var
error = Assert.Single(kvp.Value.Errors);
127
var
error = Assert.Single(kvp.Value.Errors);
157
var
modelError = formatterContext.ModelState[modelStateKey].Errors.Single();
179
var
modelError = formatterContext.ModelState["$"].Errors.Single();
Formatters\TextInputFormatterTest.cs (1)
37
var
error = context.ModelState["something"].Errors[0];
ModelBinding\Binders\ArrayModelBinderTest.cs (1)
120
var
error = Assert.Single(keyValuePair.Value.Errors);
ModelBinding\Binders\ByteArrayModelBinderTests.cs (1)
77
var
error = Assert.Single(bindingContext.ModelState["foo"].Errors);
ModelBinding\Binders\CollectionModelBinderTest.cs (1)
306
var
error = Assert.Single(keyValuePair.Value.Errors);
ModelBinding\Binders\ComplexObjectModelBinderTest.cs (6)
318
var
error = Assert.Single(keyValuePair.Value.Errors);
362
var
error = Assert.Single(keyValuePair.Value.Errors);
406
var
error = Assert.Single(keyValuePair.Value.Errors);
621
var
modelError = Assert.Single(entry.Errors);
686
var
modelError = Assert.Single(entry.Errors);
727
var
modelError = Assert.Single(entry.Errors);
ModelBinding\Binders\ComplexTypeModelBinderTest.cs (6)
378
var
error = Assert.Single(keyValuePair.Value.Errors);
422
var
error = Assert.Single(keyValuePair.Value.Errors);
466
var
error = Assert.Single(keyValuePair.Value.Errors);
799
var
modelError = Assert.Single(entry.Errors);
833
var
modelError = Assert.Single(entry.Errors);
871
var
modelError = Assert.Single(entry.Errors);
ModelBinding\Binders\DateTimeModelBinderTest.cs (3)
49
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
71
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
127
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
ModelBinding\Binders\DictionaryModelBinderTest.cs (1)
492
var
error = Assert.Single(keyValuePair.Value.Errors);
ModelBinding\Binders\EnumTypeModelBinderTest.cs (3)
43
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
148
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
231
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
ModelBinding\Binders\FloatingPointTypeModelBinderTestOfT.cs (6)
71
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
94
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
118
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
142
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
166
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
208
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
ModelBinding\Binders\HeaderModelBinderTests.cs (1)
294
var
error = Assert.Single(entry.Errors);
ModelBinding\Binders\KeyValuePairModelBinderTest.cs (2)
32
var
error = Assert.Single(bindingContext.ModelState["someName.Key"].Errors);
58
var
error = Assert.Single(state.Errors);
ModelBinding\Binders\SimpleTypeModelBinderTest.cs (4)
129
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
154
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
330
var
error = Assert.Single(entry.Value.Errors);
375
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
ModelBinding\Binders\TryParseTypeModelBinderTest.cs (6)
78
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
103
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
256
var
error = Assert.Single(entry.Value.Errors);
301
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
406
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
456
var
error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
ModelBinding\ModelBindingHelperTest.cs (1)
84
var
error = Assert.Single(modelState["MyProperty"].Errors);
ModelBinding\ParameterBinderTest.cs (8)
219
var
error = Assert.Single(modelState.Value.Errors);
353
var
error = Assert.Single(kvp.Value.Errors);
408
var
error = Assert.Single(kvp.Value.Errors);
463
var
error = Assert.Single(kvp.Value.Errors);
517
var
error = Assert.Single(kvp.Value.Errors);
576
var
error = Assert.Single(kvp.Value.Errors);
637
var
error = Assert.Single(kvp.Value.Errors);
644
var
error = Assert.Single(kvp.Value.Errors);
ModelBinding\Validation\DefaultObjectValidatorTests.cs (21)
239
var
error = Assert.Single(entry.Errors);
381
var
error = Assert.Single(entry.Errors);
418
var
error = Assert.Single(state.Value.Errors);
424
var
error = Assert.Single(state.Value.Errors);
452
var
error = Assert.Single(state.Value.Errors);
458
var
error = Assert.Single(state.Value.Errors);
491
var
error = Assert.Single(entry.Errors);
546
var
error = Assert.Single(entry.Value.Errors);
555
var
error = Assert.Single(entry.Value.Errors);
562
var
error = Assert.Single(entry.Value.Errors);
569
var
error = Assert.Single(entry.Value.Errors);
672
var
error = Assert.Single(entry.Errors);
708
var
error = Assert.Single(entry.Errors);
744
var
error = Assert.Single(entry.Errors);
805
var
error = Assert.Single(entry.Errors);
848
var
error = Assert.Single(entry.Errors);
964
var
error = Assert.Single(state.Value.Errors);
970
var
error = Assert.Single(state.Value.Errors);
1062
var
error = Assert.Single(entry.Errors);
1249
var
error = Assert.Single(kvp.Value.Errors);
1256
var
error = Assert.Single(kvp.Value.Errors);
Microsoft.AspNetCore.Mvc.IntegrationTests (76)
BodyValidationIntegrationTests.cs (6)
391
var
error = Assert.Single(modelState[key].Errors);
482
var
error = Assert.Single(entry.Value.Errors);
591
var
error = Assert.Single(state.Errors);
641
var
error = Assert.Single(street.Errors);
738
var
error = Assert.Single(street.Errors);
899
foreach (
var
error in item.Value.Errors)
CollectionModelBinderIntegrationTest.cs (3)
331
var
error = Assert.Single(entry.Errors);
679
var
error = Assert.Single(entry.Errors);
719
var
error = Assert.Single(entry.Errors);
ComplexRecordIntegrationTest.cs (12)
1994
var
error = Assert.Single(modelState["Customer"].Errors);
2050
var
error = Assert.Single(modelState["Customer"].Errors);
2108
var
error = Assert.Single(modelState["parameter.Customer.Name"].Errors);
2162
var
error = Assert.Single(modelState["Customer.Name"].Errors);
2220
var
error = Assert.Single(modelState["customParameter.Customer.Name"].Errors);
2270
var
error = Assert.Single(modelState["ProductName"].Errors);
2322
var
error = Assert.Single(modelState["customParameter.ProductName"].Errors);
2418
var
error = Assert.Single(modelState["OrderIds"].Errors);
2470
var
error = Assert.Single(modelState["customParameter.OrderIds"].Errors);
2569
var
error = Assert.Single(entry.Errors);
2619
var
error = Assert.Single(entry.Value.Errors);
4199
var
error = Assert.Single(entry.Value.Errors);
ComplexTypeIntegrationTestBase.cs (11)
2148
var
error = Assert.Single(modelState["Customer"].Errors);
2203
var
error = Assert.Single(modelState["Customer"].Errors);
2270
var
error = Assert.Single(modelState["parameter.Customer.Name"].Errors);
2324
var
error = Assert.Single(modelState["Customer.Name"].Errors);
2382
var
error = Assert.Single(modelState["customParameter.Customer.Name"].Errors);
2436
var
error = Assert.Single(modelState["ProductName"].Errors);
2488
var
error = Assert.Single(modelState["customParameter.ProductName"].Errors);
2588
var
error = Assert.Single(modelState["OrderIds"].Errors);
2640
var
error = Assert.Single(modelState["customParameter.OrderIds"].Errors);
2742
var
error = Assert.Single(entry.Errors);
2792
var
error = Assert.Single(entry.Value.Errors);
DictionaryModelBinderIntegrationTest.cs (1)
815
var
error = Assert.Single(entry.Value.Errors);
HeaderModelBinderIntegrationTest.cs (1)
62
var
error = Assert.Single(modelState[key].Errors);
KeyValuePairModelBinderIntegrationTest.cs (4)
80
var
error = Assert.Single(entry.Errors);
130
var
error = Assert.Single(entry.Errors);
172
var
error = Assert.Single(entry.Errors);
222
var
error = Assert.Single(entry.Errors);
NullableReferenceTypeIntegrationTest.cs (1)
143
var
error = Assert.Single(kvp.Value.Errors);
SimpleTypeModelBinderIntegrationTest.cs (4)
404
var
error = Assert.Single(entry.Errors);
464
var
error = Assert.Single(entry.Errors);
506
var
error = Assert.Single(modelState[key].Errors);
560
var
error = Assert.Single(modelState[key].Errors);
TryValidateModelIntegrationTest.cs (1)
230
foreach (
var
error in item.Value.Errors)
ValidationIntegrationTests.cs (16)
117
var
error = Assert.Single(entry.Errors);
236
var
error = Assert.Single(entry.Errors);
325
var
error = Assert.Single(entry.Errors);
419
var
error = Assert.Single(entry.Errors);
509
var
error = Assert.Single(entry.Errors);
597
var
error = Assert.Single(entry.Errors);
751
var
error = Assert.Single(entry.Errors);
839
var
error = Assert.Single(entry.Errors);
978
var
error = Assert.Single(entry.Errors);
1086
var
error = Assert.Single(entry.Errors);
1169
var
error = Assert.Single(entry.Errors);
1250
var
error = entry.Errors[0];
1290
var
error = entry.Errors[0];
1380
var
error = Assert.Single(state.Value.Errors);
1427
var
error = Assert.Single(state.Errors);
2570
private static void AssertRequiredError(string key,
ModelError
error)
ValidationWithRecordIntegrationTests.cs (16)
109
var
error = Assert.Single(entry.Errors);
224
var
error = Assert.Single(entry.Errors);
306
var
error = Assert.Single(entry.Errors);
391
var
error = Assert.Single(entry.Errors);
474
var
error = Assert.Single(entry.Errors);
556
var
error = Assert.Single(entry.Errors);
634
var
error = Assert.Single(entry.Errors);
715
var
error = Assert.Single(entry.Errors);
847
var
error = Assert.Single(entry.Errors);
948
var
error = Assert.Single(entry.Errors);
1027
var
error = Assert.Single(entry.Errors);
1102
var
error = entry.Errors[0];
1142
var
error = entry.Errors[0];
1224
var
error = Assert.Single(state.Value.Errors);
1271
var
error = Assert.Single(state.Errors);
2456
private static void AssertRequiredError(string key,
ModelError
error)
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (11)
JsonPatchExtensionsTest.cs (2)
26
var
error = Assert.Single(modelState["Customer"].Errors);
44
var
error = Assert.Single(modelState["jsonpatch.Customer"].Errors);
NewtonsoftJsonInputFormatterTest.cs (8)
250
var
modelError = formatterContext.ModelState[modelStateKey].Errors.Single();
276
var
error = Assert.Single(kvp.Value.Errors);
282
var
error = Assert.Single(kvp.Value.Errors);
305
var
modelError = formatterContext.ModelState[string.Empty].Errors.Single();
338
var
modelError = formatterContext.ModelState[string.Empty].Errors.Single();
369
var
modelError = Assert.Single(formatterContext.ModelState["dateValue"].Errors);
400
var
modelError = Assert.Single(formatterContext.ModelState["shortValue"].Errors);
431
var
modelError = Assert.Single(formatterContext.ModelState["Complex.WithPrimitives[0].shortValue"].Errors);
src\Mvc\Mvc.Core\test\Formatters\JsonInputFormatterTestBase.cs (1)
435
var
error = Assert.Single(formatterContext.ModelState[""].Errors);
Microsoft.AspNetCore.Mvc.RazorPages.Test (3)
Infrastructure\PageBinderFactoryTest.cs (1)
749
var
error = Assert.Single(entry.Value.Errors);
PageModelTest.cs (1)
1776
var
error = Assert.Single(modelState.Value.Errors);
PageTest.cs (1)
1854
var
error = Assert.Single(modelState.Value.Errors);
Microsoft.AspNetCore.Mvc.ViewFeatures (4)
DefaultHtmlGenerator.cs (2)
743
ModelError
modelError = null;
852
var
modelError = modelState.Errors[i];
ValidationHelpers.cs (2)
11
public static string GetModelErrorMessageOrDefault(
ModelError
modelError)
25
ModelError
modelError,
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (12)
ModelStateDictionaryExtensionsTest.cs (12)
19
var
modelError = Assert.Single(modelState.Value.Errors);
36
var
modelError = Assert.Single(modelState.Value.Errors);
53
var
modelError = Assert.Single(modelState.Value.Errors);
71
var
modelError = Assert.Single(modelState.Value.Errors);
89
var
modelError = Assert.Single(modelState.Value.Errors);
109
var
modelError = Assert.Single(modelState.Value.Errors);
127
var
modelError = Assert.Single(modelState.Value.Errors);
147
var
modelError = Assert.Single(modelState.Value.Errors);
165
var
modelError = Assert.Single(modelState.Value.Errors);
185
var
modelError = Assert.Single(modelState.Value.Errors);
204
var
modelError = Assert.Single(modelState.Value.Errors);
225
var
modelError = Assert.Single(modelState.Value.Errors);
XmlFormattersWebSite (1)
Controllers\ValidationController.cs (1)
36
foreach (
var
modelError in errors)