File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/Components/Web/src/Forms Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -187,6 +187,7 @@ protected string CssClass
187187
188188
189189 /// <inheritdoc />
190+ [ MemberNotNull ( nameof ( EditContext ) , nameof ( CascadedEditContext ) ) ]
190191 public override Task SetParametersAsync ( ParameterView parameters )
191192 {
192193 parameters . SetParameterProperties ( this ) ;
@@ -315,7 +316,12 @@ protected virtual void Dispose(bool disposing)
315316
316317 void IDisposable . Dispose ( )
317318 {
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+
319325 Dispose ( disposing : true ) ;
320326 }
321327 }
You can’t perform that action at this time.
0 commit comments