Skip to content

Commit

Permalink
feat: use Meziantou.Polyfill to allow for nullable static analysis in…
Browse files Browse the repository at this point in the history
… HttpClientRequestResult
  • Loading branch information
JMolenkamp committed Jun 12, 2024
1 parent 523a045 commit b9fccdd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Atc/Atc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Meziantou.Polyfill" Version="1.0.38">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.3" />
Expand Down
3 changes: 3 additions & 0 deletions src/Atc/Data/Models/HttpClientRequestResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,15 @@ public HttpClientRequestResult(

public Exception? Exception { get; set; }

[MemberNotNullWhen(true, nameof(Data))]
public bool HasData
=> Data is not null;

[MemberNotNullWhen(true, nameof(Message))]
public bool HasMessage
=> !string.IsNullOrEmpty(Message);

[MemberNotNullWhen(true, nameof(Exception))]
public bool HasException
=> Exception is not null;

Expand Down

0 comments on commit b9fccdd

Please sign in to comment.