1- // Copyright (c) .NET Foundation. All rights reserved.
1+ // Copyright (c) .NET Foundation. All rights reserved.
22// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33
44using System ;
55using System . Collections . Generic ;
66using System . Collections . ObjectModel ;
77using System . Collections . Specialized ;
88using System . Diagnostics ;
9+ using System . Diagnostics . CodeAnalysis ;
910using System . Linq ;
1011using System . Text ;
1112using System . Threading ;
@@ -21,8 +22,8 @@ namespace Microsoft.AspNetCore.Routing
2122 public sealed class CompositeEndpointDataSource : EndpointDataSource
2223 {
2324 private readonly object _lock ;
24- private readonly ICollection < EndpointDataSource > _dataSources ;
25- private IReadOnlyList < Endpoint > _endpoints ;
25+ private readonly ICollection < EndpointDataSource > _dataSources = default ! ;
26+ private IReadOnlyList < Endpoint > _endpoints = default ! ;
2627 private IChangeToken _consumerChangeToken ;
2728 private CancellationTokenSource _cts ;
2829
@@ -49,7 +50,7 @@ public CompositeEndpointDataSource(IEnumerable<EndpointDataSource> endpointDataS
4950 }
5051 }
5152
52- private void OnDataSourcesChanged ( object sender , NotifyCollectionChangedEventArgs e )
53+ private void OnDataSourcesChanged ( object ? sender , NotifyCollectionChangedEventArgs e )
5354 {
5455 lock ( _lock )
5556 {
@@ -140,6 +141,7 @@ private void HandleChange()
140141 }
141142 }
142143
144+ [ MemberNotNull ( nameof ( _cts ) , nameof ( _consumerChangeToken ) ) ]
143145 private void CreateChangeToken ( )
144146 {
145147 _cts = new CancellationTokenSource ( ) ;
@@ -198,7 +200,7 @@ private string DebuggerDisplayString
198200 }
199201 return sb . ToString ( ) ;
200202
201- IEnumerable < string > FormatValues ( IEnumerable < KeyValuePair < string , object > > values )
203+ IEnumerable < string > FormatValues ( IEnumerable < KeyValuePair < string , object ? > > values )
202204 {
203205 return values . Select (
204206 kvp =>
0 commit comments