33
44using System ;
55using System . Collections . Generic ;
6+ using System . Diagnostics . CodeAnalysis ;
67using System . Linq ;
78using System . Linq . Expressions ;
89using System . Threading . Tasks ;
@@ -16,7 +17,7 @@ namespace Microsoft.AspNetCore.Components.Forms
1617 /// </summary>
1718 public abstract class InputBase < TValue > : ComponentBase , IDisposable
1819 {
19- private readonly EventHandler < ValidationStateChangedEventArgs > ? _validationStateChangedHandler ;
20+ private readonly EventHandler < ValidationStateChangedEventArgs > _validationStateChangedHandler ;
2021 private bool _previousParsingAttemptFailed ;
2122 private ValidationMessageStore ? _parsingValidationMessages ;
2223 private Type ? _nullableUnderlyingType ;
@@ -228,7 +229,7 @@ public override Task SetParametersAsync(ParameterView parameters)
228229 return base . SetParametersAsync ( ParameterView . Empty ) ;
229230 }
230231
231- private void OnValidateStateChanged ( object sender , ValidationStateChangedEventArgs eventArgs )
232+ private void OnValidateStateChanged ( object ? sender , ValidationStateChangedEventArgs eventArgs )
232233 {
233234 SetAdditionalAttributesIfValidationFailed ( ) ;
234235
@@ -260,21 +261,21 @@ private void SetAdditionalAttributesIfValidationFailed()
260261 /// Returns a dictionary with the same values as the specified <paramref name="source"/>.
261262 /// </summary>
262263 /// <returns>true, if a new dictrionary with copied values was created. false - otherwise.</returns>
263- private bool ConvertToDictionary ( IReadOnlyDictionary < string , object > source , out Dictionary < string , object > result )
264+ private bool ConvertToDictionary ( IReadOnlyDictionary < string , object ? > ? source , out Dictionary < string , object ? > result )
264265 {
265- bool newDictionaryCreated = true ;
266+ var newDictionaryCreated = true ;
266267 if ( source == null )
267268 {
268- result = new Dictionary < string , object > ( ) ;
269+ result = new Dictionary < string , object ? > ( ) ;
269270 }
270- else if ( source is Dictionary < string , object > currentDictionary )
271+ else if ( source is Dictionary < string , object ? > currentDictionary )
271272 {
272273 result = currentDictionary ;
273274 newDictionaryCreated = false ;
274275 }
275276 else
276277 {
277- result = new Dictionary < string , object > ( ) ;
278+ result = new Dictionary < string , object ? > ( ) ;
278279 foreach ( var item in source )
279280 {
280281 result . Add ( item . Key , item . Value ) ;
@@ -290,7 +291,7 @@ protected virtual void Dispose(bool disposing)
290291
291292 void IDisposable . Dispose ( )
292293 {
293- EditContext . OnValidationStateChanged -= _validationStateChangedHandler ;
294+ EditContext . OnValidationStateChanged -= _validationStateChangedHandler ;
294295 Dispose ( disposing : true ) ;
295296 }
296297 }
0 commit comments