Skip to content

Commit c1569e2

Browse files
committed
fix: build warnings/errors from net6 compiler/sdk
1 parent 63f1f62 commit c1569e2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/bunit.core/Extensions/RenderedComponentRenderExtensions.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public static void SetParametersAndRender<TComponent>(this IRenderedComponentBas
4949
{
5050
if (renderedComponent is null)
5151
throw new ArgumentNullException(nameof(renderedComponent));
52+
if (parameters is null)
53+
throw new ArgumentNullException(nameof(parameters));
5254

5355
SetParametersAndRender(renderedComponent, ToParameterView(parameters));
5456
}
@@ -77,7 +79,7 @@ private static ParameterView ToParameterView(IReadOnlyCollection<ComponentParame
7779

7880
if (parameters.Count > 0)
7981
{
80-
var paramDict = new Dictionary<string, object>(StringComparer.Ordinal);
82+
var paramDict = new Dictionary<string, object?>(StringComparer.Ordinal);
8183

8284
foreach (var param in parameters)
8385
{
@@ -86,11 +88,14 @@ private static ParameterView ToParameterView(IReadOnlyCollection<ComponentParame
8688
if (param.Name is null)
8789
throw new InvalidOperationException($"A parameters name is required.");
8890

89-
// BANG: it should technically be allowed to pass null
90-
paramDict.Add(param.Name, param.Value!);
91+
paramDict.Add(param.Name, param.Value);
9192
}
9293

94+
// Nullable is disabled to get around the issue with different annotations
95+
// between .netstandard2.1 and net6.
96+
#nullable disable
9397
parameterView = ParameterView.FromDictionary(paramDict);
98+
#nullable restore
9499
}
95100

96101
return parameterView;

0 commit comments

Comments
 (0)