3
3
4
4
using System ;
5
5
using System . Collections . Generic ;
6
+ using System . Diagnostics . CodeAnalysis ;
6
7
using System . Linq ;
7
8
using System . Linq . Expressions ;
8
9
using System . Threading . Tasks ;
@@ -16,7 +17,7 @@ namespace Microsoft.AspNetCore.Components.Forms
16
17
/// </summary>
17
18
public abstract class InputBase < TValue > : ComponentBase , IDisposable
18
19
{
19
- private readonly EventHandler < ValidationStateChangedEventArgs > ? _validationStateChangedHandler ;
20
+ private readonly EventHandler < ValidationStateChangedEventArgs > _validationStateChangedHandler ;
20
21
private bool _previousParsingAttemptFailed ;
21
22
private ValidationMessageStore ? _parsingValidationMessages ;
22
23
private Type ? _nullableUnderlyingType ;
@@ -228,7 +229,7 @@ public override Task SetParametersAsync(ParameterView parameters)
228
229
return base . SetParametersAsync ( ParameterView . Empty ) ;
229
230
}
230
231
231
- private void OnValidateStateChanged ( object sender , ValidationStateChangedEventArgs eventArgs )
232
+ private void OnValidateStateChanged ( object ? sender , ValidationStateChangedEventArgs eventArgs )
232
233
{
233
234
SetAdditionalAttributesIfValidationFailed ( ) ;
234
235
@@ -260,21 +261,21 @@ private void SetAdditionalAttributesIfValidationFailed()
260
261
/// Returns a dictionary with the same values as the specified <paramref name="source"/>.
261
262
/// </summary>
262
263
/// <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 )
264
265
{
265
- bool newDictionaryCreated = true ;
266
+ var newDictionaryCreated = true ;
266
267
if ( source == null )
267
268
{
268
- result = new Dictionary < string , object > ( ) ;
269
+ result = new Dictionary < string , object ? > ( ) ;
269
270
}
270
- else if ( source is Dictionary < string , object > currentDictionary )
271
+ else if ( source is Dictionary < string , object ? > currentDictionary )
271
272
{
272
273
result = currentDictionary ;
273
274
newDictionaryCreated = false ;
274
275
}
275
276
else
276
277
{
277
- result = new Dictionary < string , object > ( ) ;
278
+ result = new Dictionary < string , object ? > ( ) ;
278
279
foreach ( var item in source )
279
280
{
280
281
result . Add ( item . Key , item . Value ) ;
@@ -290,7 +291,7 @@ protected virtual void Dispose(bool disposing)
290
291
291
292
void IDisposable . Dispose ( )
292
293
{
293
- EditContext . OnValidationStateChanged -= _validationStateChangedHandler ;
294
+ EditContext . OnValidationStateChanged -= _validationStateChangedHandler ;
294
295
Dispose ( disposing : true ) ;
295
296
}
296
297
}
0 commit comments