Skip to content

Commit ec12b83

Browse files
committed
Fixes
1 parent d739000 commit ec12b83

File tree

7 files changed

+38
-34
lines changed

7 files changed

+38
-34
lines changed

src/Servers/Kestrel/Core/src/Internal/Http/HttpHeaders.Generated.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14221,4 +14221,4 @@ public bool MoveNext()
1422114221
}
1422214222
}
1422314223
}
14224-
}
14224+
}

src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.Generated.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ TFeature IFeatureCollection.Get<TFeature>()
501501
feature = ConnectionFeatures.Get<TFeature>();
502502
}
503503

504-
return feature;
504+
return feature!;
505505
}
506506

507507
void IFeatureCollection.Set<TFeature>(TFeature feature)

src/Servers/Kestrel/Core/src/Internal/Infrastructure/HttpUtilities.Generated.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ private static int GetKnownMethodIndex(ulong value)
7272
return ((tmp >> 2) | (tmp >> 23)) & 0xF;
7373
}
7474
}
75-
}
75+
}

src/Servers/Kestrel/shared/TransportConnection.Generated.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ namespace Microsoft.AspNetCore.Connections
1414
{
1515
internal partial class TransportConnection : IFeatureCollection
1616
{
17-
private object _currentIConnectionIdFeature;
18-
private object _currentIConnectionTransportFeature;
19-
private object _currentIConnectionItemsFeature;
20-
private object _currentIMemoryPoolFeature;
21-
private object _currentIConnectionLifetimeFeature;
17+
private object? _currentIConnectionIdFeature;
18+
private object? _currentIConnectionTransportFeature;
19+
private object? _currentIConnectionItemsFeature;
20+
private object? _currentIMemoryPoolFeature;
21+
private object? _currentIConnectionLifetimeFeature;
2222

2323
private int _featureRevision;
2424

25-
private List<KeyValuePair<Type, object>> MaybeExtra;
25+
private List<KeyValuePair<Type, object>>? MaybeExtra;
2626

2727
private void FastReset()
2828
{
@@ -42,7 +42,7 @@ internal void ResetFeatureCollection()
4242
_featureRevision++;
4343
}
4444

45-
private object ExtraFeatureGet(Type key)
45+
private object? ExtraFeatureGet(Type key)
4646
{
4747
if (MaybeExtra == null)
4848
{
@@ -81,11 +81,11 @@ private void ExtraFeatureSet(Type key, object value)
8181

8282
int IFeatureCollection.Revision => _featureRevision;
8383

84-
object IFeatureCollection.this[Type key]
84+
object? IFeatureCollection.this[Type key]
8585
{
8686
get
8787
{
88-
object feature = null;
88+
object? feature = null;
8989
if (key == typeof(IConnectionIdFeature))
9090
{
9191
feature = _currentIConnectionIdFeature;
@@ -140,7 +140,7 @@ object IFeatureCollection.this[Type key]
140140
}
141141
else
142142
{
143-
ExtraFeatureSet(key, value);
143+
ExtraFeatureSet(key, value!); // TODO: What happens if you set an extra feature with a null value?
144144
}
145145
}
146146
}
@@ -173,7 +173,7 @@ TFeature IFeatureCollection.Get<TFeature>()
173173
feature = (TFeature?)(ExtraFeatureGet(typeof(TFeature)));
174174
}
175175

176-
return feature;
176+
return feature!;
177177
}
178178

179179
void IFeatureCollection.Set<TFeature>(TFeature feature)
@@ -201,7 +201,7 @@ void IFeatureCollection.Set<TFeature>(TFeature feature)
201201
}
202202
else
203203
{
204-
ExtraFeatureSet(typeof(TFeature), feature);
204+
ExtraFeatureSet(typeof(TFeature), feature!); // TODO: What happens if you set an extra feature with a null value?
205205
}
206206
}
207207

src/Servers/Kestrel/shared/TransportMultiplexedConnection.Generated.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ namespace Microsoft.AspNetCore.Connections
1414
{
1515
internal partial class TransportMultiplexedConnection : IFeatureCollection
1616
{
17-
private object _currentIConnectionIdFeature;
18-
private object _currentIConnectionTransportFeature;
19-
private object _currentIConnectionItemsFeature;
20-
private object _currentIMemoryPoolFeature;
21-
private object _currentIConnectionLifetimeFeature;
17+
private object? _currentIConnectionIdFeature;
18+
private object? _currentIConnectionTransportFeature;
19+
private object? _currentIConnectionItemsFeature;
20+
private object? _currentIMemoryPoolFeature;
21+
private object? _currentIConnectionLifetimeFeature;
2222

2323
private int _featureRevision;
2424

25-
private List<KeyValuePair<Type, object>> MaybeExtra;
25+
private List<KeyValuePair<Type, object>>? MaybeExtra;
2626

2727
private void FastReset()
2828
{
@@ -42,7 +42,7 @@ internal void ResetFeatureCollection()
4242
_featureRevision++;
4343
}
4444

45-
private object ExtraFeatureGet(Type key)
45+
private object? ExtraFeatureGet(Type key)
4646
{
4747
if (MaybeExtra == null)
4848
{
@@ -81,11 +81,11 @@ private void ExtraFeatureSet(Type key, object value)
8181

8282
int IFeatureCollection.Revision => _featureRevision;
8383

84-
object IFeatureCollection.this[Type key]
84+
object? IFeatureCollection.this[Type key]
8585
{
8686
get
8787
{
88-
object feature = null;
88+
object? feature = null;
8989
if (key == typeof(IConnectionIdFeature))
9090
{
9191
feature = _currentIConnectionIdFeature;
@@ -140,40 +140,40 @@ object IFeatureCollection.this[Type key]
140140
}
141141
else
142142
{
143-
ExtraFeatureSet(key, value);
143+
ExtraFeatureSet(key, value!); // TODO: What happens if you set an extra feature with a null value?
144144
}
145145
}
146146
}
147147

148148
TFeature IFeatureCollection.Get<TFeature>()
149149
{
150-
TFeature feature = default;
150+
TFeature? feature = default;
151151
if (typeof(TFeature) == typeof(IConnectionIdFeature))
152152
{
153-
feature = (TFeature)_currentIConnectionIdFeature;
153+
feature = (TFeature?)_currentIConnectionIdFeature;
154154
}
155155
else if (typeof(TFeature) == typeof(IConnectionTransportFeature))
156156
{
157-
feature = (TFeature)_currentIConnectionTransportFeature;
157+
feature = (TFeature?)_currentIConnectionTransportFeature;
158158
}
159159
else if (typeof(TFeature) == typeof(IConnectionItemsFeature))
160160
{
161-
feature = (TFeature)_currentIConnectionItemsFeature;
161+
feature = (TFeature?)_currentIConnectionItemsFeature;
162162
}
163163
else if (typeof(TFeature) == typeof(IMemoryPoolFeature))
164164
{
165-
feature = (TFeature)_currentIMemoryPoolFeature;
165+
feature = (TFeature?)_currentIMemoryPoolFeature;
166166
}
167167
else if (typeof(TFeature) == typeof(IConnectionLifetimeFeature))
168168
{
169-
feature = (TFeature)_currentIConnectionLifetimeFeature;
169+
feature = (TFeature?)_currentIConnectionLifetimeFeature;
170170
}
171171
else if (MaybeExtra != null)
172172
{
173-
feature = (TFeature)(ExtraFeatureGet(typeof(TFeature)));
173+
feature = (TFeature?)(ExtraFeatureGet(typeof(TFeature)));
174174
}
175175

176-
return feature;
176+
return feature!;
177177
}
178178

179179
void IFeatureCollection.Set<TFeature>(TFeature feature)
@@ -201,7 +201,7 @@ void IFeatureCollection.Set<TFeature>(TFeature feature)
201201
}
202202
else
203203
{
204-
ExtraFeatureSet(typeof(TFeature), feature);
204+
ExtraFeatureSet(typeof(TFeature), feature!); // TODO: What happens if you set an extra feature with a null value?
205205
}
206206
}
207207

src/Servers/Kestrel/tools/CodeGenerator/HttpUtilities/HttpUtilities.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ private static string GenerateFile(Tuple<string, String>[] httpMethods)
6868
using Microsoft.AspNetCore.Http;
6969
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
7070
71+
#nullable enable
72+
7173
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure
7274
{{
7375
internal static partial class HttpUtilities

src/Servers/Kestrel/tools/CodeGenerator/ReadOnlySpanStaticDataGenerator.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public static string GenerateFile(string namespaceName, string className, IEnume
2424
2525
using System;
2626
27+
#nullable enable
28+
2729
namespace {namespaceName}
2830
{{
2931
internal partial class {className}

0 commit comments

Comments
 (0)