File tree 1 file changed +7
-1
lines changed
src/Components/Web/src/Forms
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -187,6 +187,7 @@ protected string CssClass
187
187
188
188
189
189
/// <inheritdoc />
190
+ [ MemberNotNull ( nameof ( EditContext ) , nameof ( CascadedEditContext ) ) ]
190
191
public override Task SetParametersAsync ( ParameterView parameters )
191
192
{
192
193
parameters . SetParameterProperties ( this ) ;
@@ -315,7 +316,12 @@ protected virtual void Dispose(bool disposing)
315
316
316
317
void IDisposable . Dispose ( )
317
318
{
318
- EditContext . OnValidationStateChanged -= _validationStateChangedHandler ;
319
+ // When initialization in the SetParametersAsync method fails, the EditContext property can remain equal to null
320
+ if ( EditContext is not null )
321
+ {
322
+ EditContext . OnValidationStateChanged -= _validationStateChangedHandler ;
323
+ }
324
+
319
325
Dispose ( disposing : true ) ;
320
326
}
321
327
}
You can’t perform that action at this time.
0 commit comments