Add Roslyn analyzer to check results are used (#2443)

As seen in #2441, it is easy to drop return values of updated entities accidentally.

This PR adds a Roslyn Analyzer which will detect when return values are unused. To explicitly ignore a value you can drop it with `_ = …;`

Closes #2442.
This commit is contained in:
George Pollard
2022-09-27 11:26:06 +13:00
committed by GitHub
parent bb2e8ad05e
commit 5ee4cd045d
55 changed files with 299 additions and 216 deletions

View File

@ -74,8 +74,8 @@ public abstract class DownloadTestBase : FunctionTestBase {
// set up a file to download
var containerName = Container.Parse("xxx");
var container = GetContainerClient(containerName);
await container.CreateAsync();
await container.UploadBlobAsync("yyy", new BinaryData("content"));
_ = await container.CreateAsync();
_ = await container.UploadBlobAsync("yyy", new BinaryData("content"));
var req = TestHttpRequestData.Empty("GET");
var url = new UriBuilder(req.Url) { Query = "container=xxx&filename=yyy" }.Uri;