Make AddComponentReferenceCapture delegate non-null (#24842)

* Make the sample nullable enabled

Fixes https://github.com/dotnet/aspnetcore/issues/24794
This commit is contained in:
Pranav K 2020-08-13 13:24:31 -07:00 committed by GitHub
parent 3f6ea38f44
commit 3e61104425
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 8 additions and 7 deletions

View File

@ -104,7 +104,7 @@ namespace Microsoft.AspNetCore.Components.RenderTree
}; };
} }
public void AppendComponentReferenceCapture(int sequence, Action<object?> componentReferenceCaptureAction, int parentFrameIndexValue) public void AppendComponentReferenceCapture(int sequence, Action<object> componentReferenceCaptureAction, int parentFrameIndexValue)
{ {
if (_itemsInUse == _items.Length) if (_itemsInUse == _items.Length)
{ {

View File

@ -586,7 +586,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
/// </summary> /// </summary>
/// <param name="sequence">An integer that represents the position of the instruction in the source code.</param> /// <param name="sequence">An integer that represents the position of the instruction in the source code.</param>
/// <param name="componentReferenceCaptureAction">An action to be invoked whenever the reference value changes.</param> /// <param name="componentReferenceCaptureAction">An action to be invoked whenever the reference value changes.</param>
public void AddComponentReferenceCapture(int sequence, Action<object?> componentReferenceCaptureAction) public void AddComponentReferenceCapture(int sequence, Action<object> componentReferenceCaptureAction)
{ {
var parentFrameIndex = GetCurrentParentFrameIndex(); var parentFrameIndex = GetCurrentParentFrameIndex();
if (!parentFrameIndex.HasValue) if (!parentFrameIndex.HasValue)

View File

@ -3,6 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework> <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<IsShippingPackage>false</IsShippingPackage> <IsShippingPackage>false</IsShippingPackage>
<Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -10,6 +10,6 @@ namespace BlazorServerApp.Data
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string Summary { get; set; } public string Summary { get; set; } = default!;
} }
} }

View File

@ -37,7 +37,7 @@ else
} }
@code { @code {
WeatherForecast[] forecasts; WeatherForecast[]? forecasts;
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {

View File

@ -28,7 +28,7 @@
@code { @code {
bool collapseNavMenu = true; bool collapseNavMenu = true;
string NavMenuCssClass => collapseNavMenu ? "collapse" : null; string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
void ToggleNavMenu() void ToggleNavMenu()
{ {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long