Skip to content

Commit

Permalink
Add threading code analyzer and fix warnings being caught (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanabi1224 authored and richardschneider committed Jun 13, 2019
1 parent 6812916 commit e3f1a95
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/IpfsCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<PackageReference Include="SimpleBase" Version="1.4.1" />
<PackageReference Include="Grpc.Tools" Version="1.21.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19270-01" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="16.0.102" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/VarInt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static long DecodeInt64(byte[] bytes, int offset = 0)
/// </exception>
public static void WriteVarint(this Stream stream, long value)
{
stream.WriteVarintAsync(value).Wait();
stream.WriteVarintAsync(value).ConfigureAwait(false).GetAwaiter().GetResult();
}

/// <summary>
Expand All @@ -131,7 +131,7 @@ public static void WriteVarint(this Stream stream, long value)
/// <returns>The integer value.</returns>
public static int ReadVarint32(this Stream stream)
{
return stream.ReadVarint32Async().Result;
return stream.ReadVarint32Async().ConfigureAwait(false).GetAwaiter().GetResult();
}

/// <summary>
Expand All @@ -149,7 +149,7 @@ public static int ReadVarint32(this Stream stream)
/// <returns>The integer value.</returns>
public static long ReadVarint64(this Stream stream)
{
return stream.ReadVarint64Async().Result;
return stream.ReadVarint64Async().ConfigureAwait(false).GetAwaiter().GetResult();
}

/// <summary>
Expand Down

0 comments on commit e3f1a95

Please sign in to comment.