Skip to content

Commit

Permalink
Add net5.0 to target frameworks and fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nickelc committed May 16, 2021
1 parent 0edf24b commit b2c4e70
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Modio/Exceptions/ApiException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static ApiError GetApiError(string? message)
if (!string.IsNullOrEmpty(message))
{
var error = JsonSerializer.Deserialize<ApiErrorResponse>(message);
return error.Error ?? new ApiError(message);
return error!.Error ?? new ApiError(message);
}
}
catch (Exception)
Expand Down
4 changes: 2 additions & 2 deletions Modio/Helpers/EditResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ public override EditResult<T> Read(ref Utf8JsonReader reader, Type typeToConvert
var restore = reader;

var msg = JsonSerializer.Deserialize<ApiMessage>(ref reader, options);
if (msg.Code != null && msg.Message != null)
if (msg!.Code != null && msg.Message != null)
{
return new EditResult<T>(null);
}

reader = restore;
var entityType = typeToConvert.GetGenericArguments()[0];
var entity = (T)JsonSerializer.Deserialize(ref reader, entityType, options);
var entity = (T?)JsonSerializer.Deserialize(ref reader, entityType, options);
return new EditResult<T>(entity);
}

Expand Down
2 changes: 1 addition & 1 deletion Modio/Helpers/NoHttpContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public NoHttpContent(string mediaType)
Headers.ContentType = new MediaTypeHeaderValue(mediaType);
}

protected override Task SerializeToStreamAsync(Stream stream, TransportContext context)
protected override Task SerializeToStreamAsync(Stream stream, TransportContext? context)
{
return Task.CompletedTask;
}
Expand Down
4 changes: 2 additions & 2 deletions Modio/Helpers/Parameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Modio
{
internal class Parameters : List<KeyValuePair<string, string>>
internal class Parameters : List<KeyValuePair<string?, string?>>
{
public Parameters() { }

Expand All @@ -17,7 +17,7 @@ public Parameters(IEnumerable<(string, string)> values)

public void Add(string name, string value)
{
Add(new KeyValuePair<string, string>(name, value));
Add(new KeyValuePair<string?, string?>(name, value));
}

public HttpContent ToContent()
Expand Down
2 changes: 1 addition & 1 deletion Modio/Http/Response.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public Response(HttpStatusCode statusCode, IReadOnlyDictionary<string, string> h
Headers = headers;
}

public Response(HttpStatusCode statusCode, IReadOnlyDictionary<string, string> headers, object? httpContent, T body)
public Response(HttpStatusCode statusCode, IReadOnlyDictionary<string, string> headers, object? httpContent, T? body)
{
StatusCode = statusCode;
Headers = headers;
Expand Down
2 changes: 1 addition & 1 deletion Modio/Models/Response/Metadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public override Metadata Read(ref Utf8JsonReader reader, Type typeToConvert, Jso

var kvp = JsonSerializer.Deserialize<KVP>(ref reader);

if (kvp.Key == null || kvp.Value == null)
if (kvp!.Key == null || kvp.Value == null)
{
throw new JsonException("invalid metadata kvp entry");
}
Expand Down
2 changes: 1 addition & 1 deletion Modio/Modio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PackageTags>modio API modding dotnetcore</PackageTags>

<LangVersion>8.0</LangVersion>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0</TargetFrameworks>
<Nullable>enable</Nullable>
<NullableContextOptions>enable</NullableContextOptions>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down

0 comments on commit b2c4e70

Please sign in to comment.