Skip to content

Commit ce7ff12

Browse files
committed
Enable C# 8 nullable reference types
1 parent c65180e commit ce7ff12

File tree

71 files changed

+296
-288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+296
-288
lines changed

Benchmarks/Boxed.Mapping.Benchmark/MapArrayBenchmark.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class MapArrayBenchmark
2323
private readonly IMapper automapper;
2424
private readonly IMapper<MapFrom, MapTo> boilerplateMapper;
2525
private readonly Random random;
26-
private MapFrom[] mapFrom;
26+
private MapFrom[] mapFrom = default!;
2727

2828
public MapArrayBenchmark()
2929
{

Benchmarks/Boxed.Mapping.Benchmark/MapListBenchmark.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class MapListBenchmark
2424
private readonly IMapper automapper;
2525
private readonly IMapper<MapFrom, MapTo> boilerplateMapper;
2626
private readonly Random random;
27-
private List<MapFrom> mapFrom;
27+
private List<MapFrom> mapFrom = default!;
2828

2929
public MapListBenchmark()
3030
{

Benchmarks/Boxed.Mapping.Benchmark/MapObjectBenchmark.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class MapObjectBenchmark
2323
private readonly IMapper automapper;
2424
private readonly IMapper<MapFrom, MapTo> boilerplateMapper;
2525
private readonly Random random;
26-
private MapFrom mapFrom;
26+
private MapFrom mapFrom = default!;
2727

2828
public MapObjectBenchmark()
2929
{

Benchmarks/Boxed.Mapping.Benchmark/Models/MapFrom.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ public class MapFrom
1212

1313
public long LongFrom { get; set; }
1414

15-
public string StringFrom { get; set; }
15+
public string? StringFrom { get; set; }
1616
}
1717
}

Benchmarks/Boxed.Mapping.Benchmark/Models/MapTo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ public class MapTo
1212

1313
public long LongTo { get; set; }
1414

15-
public string StringTo { get; set; }
15+
public string? StringTo { get; set; }
1616
}
1717
}

Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<LangVersion>latest</LangVersion>
55
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
66
<AnalysisLevel>latest</AnalysisLevel>
7+
<Nullable>enable</Nullable>
78
<NeutralLanguage>en-GB</NeutralLanguage>
89
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
910
</PropertyGroup>

Source/Boxed.AspNetCore.TagHelpers/HrefSubresourceIntegrityTagHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public HrefSubresourceIntegrityTagHelper(
3434

3535
/// <inheritdoc />
3636
[HtmlAttributeName(SubresourceIntegrityHrefAttributeName)]
37-
public override string Source { get; set; }
37+
public override string? Source { get; set; }
3838

3939
/// <inheritdoc />
4040
protected override string UrlAttributeName => HrefAttributeName;

Source/Boxed.AspNetCore.TagHelpers/HtmlHelperExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static class HtmlHelperExtensions
1515
/// <param name="htmlHelper">The HTML helper.</param>
1616
/// <param name="referrerMode">The type of referrer allowed to be sent.</param>
1717
/// <returns>The referrer meta tag.</returns>
18-
public static HtmlString ReferrerMeta(this IHtmlHelper htmlHelper, ReferrerMode referrerMode)
18+
public static HtmlString? ReferrerMeta(this IHtmlHelper htmlHelper, ReferrerMode referrerMode)
1919
{
2020
if (htmlHelper is null)
2121
{

Source/Boxed.AspNetCore.TagHelpers/OpenGraph/Media/OpenGraphMedia.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public abstract class OpenGraphMedia
1212
/// Initializes a new instance of the <see cref="OpenGraphMedia"/> class.
1313
/// </summary>
1414
/// <param name="mediaUrl">The media URL.</param>
15-
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="mediaUrl"/> is <c>null</c>.</exception>
15+
/// <exception cref="ArgumentNullException">Thrown if <paramref name="mediaUrl"/> is <c>null</c>.</exception>
1616
public OpenGraphMedia(Uri mediaUrl)
1717
{
1818
if (mediaUrl is null)
@@ -39,7 +39,7 @@ public OpenGraphMedia(Uri mediaUrl)
3939
/// Gets or sets the MIME type of the media e.g. media/jpeg. This is optional if your media URL ends with a file extension,
4040
/// otherwise it is recommended.
4141
/// </summary>
42-
public string Type { get; set; }
42+
public string? Type { get; set; }
4343

4444
/// <summary>
4545
/// Gets the absolute HTTP media URL which should represent your object within the graph.
@@ -49,7 +49,7 @@ public OpenGraphMedia(Uri mediaUrl)
4949
/// <summary>
5050
/// Gets the absolute HTTPS media URL which should represent your object within the graph.
5151
/// </summary>
52-
public Uri UrlSecure { get; }
52+
public Uri? UrlSecure { get; }
5353

5454
/// <summary>
5555
/// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags.

Source/Boxed.AspNetCore.TagHelpers/OpenGraph/ObjectTypes/Facebook/OpenGraphBooksAuthor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class OpenGraphBooksAuthor : OpenGraphMetadata
2525
/// Gets or sets the URL's to the pages about the books written by the author. This URL must contain books.book meta tags <see cref="OpenGraphBooksBook"/>.
2626
/// </summary>
2727
[HtmlAttributeName(BookUrlsAttributeName)]
28-
public IEnumerable<string> BookUrls { get; set; }
28+
public IEnumerable<string>? BookUrls { get; set; }
2929

3030
/// <summary>
3131
/// Gets or sets the authors gender.
@@ -37,7 +37,7 @@ public class OpenGraphBooksAuthor : OpenGraphMetadata
3737
/// Gets or sets the URL's to the pages about the genres of books the author typically writes. This URL must contain books.genre meta tags <see cref="OpenGraphBooksGenre"/>.
3838
/// </summary>
3939
[HtmlAttributeName(GenreUrlsAttributeName)]
40-
public IEnumerable<string> GenreUrls { get; set; }
40+
public IEnumerable<string>? GenreUrls { get; set; }
4141

4242
/// <summary>
4343
/// Gets the namespace of this open graph type.
@@ -48,7 +48,7 @@ public class OpenGraphBooksAuthor : OpenGraphMetadata
4848
/// Gets or sets the official site URL of the author.
4949
/// </summary>
5050
[HtmlAttributeName(OfficialSiteUrlAttributeName)]
51-
public Uri OfficialSiteUrl { get; set; }
51+
public Uri? OfficialSiteUrl { get; set; }
5252

5353
/// <summary>
5454
/// Gets the type of your object. Depending on the type you specify, other properties may also be required.

0 commit comments

Comments
 (0)