Add a Troubleshoot section to Blazor forms topic (#18521)

pull/18528/head
Luke Latham 2020-05-27 19:32:38 -05:00 committed by GitHub
parent 4485fa7e89
commit 40f282b00b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -5,7 +5,7 @@ description: Learn how to use forms and field validation scenarios in Blazor.
monikerRange: '>= aspnetcore-3.1'
ms.author: riande
ms.custom: mvc
ms.date: 03/17/2020
ms.date: 05/27/2020
no-loc: [Blazor, "Identity", "Let's Encrypt", Razor, SignalR]
uid: blazor/forms-validation
---
@ -521,3 +521,15 @@ A side effect of the preceding approach is that a <xref:Microsoft.AspNetCore.Com
}
}
```
## Troubleshoot
> InvalidOperationException: EditForm requires a Model parameter, or an EditContext parameter, but not both.
Confirm that the <xref:Microsoft.AspNetCore.Components.Forms.EditForm> has a <xref:Microsoft.AspNetCore.Components.Forms.EditForm.Model> or <xref:Microsoft.AspNetCore.Components.Forms.EditContext>.
When assigning a <xref:Microsoft.AspNetCore.Components.Forms.EditForm.Model> to the form, confirm that the model type is instantiated, as the following example shows:
```csharp
private ExampleModel exampleModel = new ExampleModel();
```