Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Commit 31929a8

Browse files
authored
Fixing build issue related to dotnet version 7.0.101 (#2698)
1 parent 4c1adb6 commit 31929a8

File tree

24 files changed

+66
-67
lines changed

24 files changed

+66
-67
lines changed

src/ApiService/ApiService/GroupMembershipChecker.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public async ValueTask<bool> IsMember(IEnumerable<Guid> groupIds, Guid memberId)
1515
}
1616
}
1717

18-
class AzureADGroupMembership : GroupMembershipChecker {
18+
sealed class AzureADGroupMembership : GroupMembershipChecker {
1919
private readonly GraphServiceClient _graphClient;
2020
public AzureADGroupMembership(GraphServiceClient graphClient) => _graphClient = graphClient;
2121
protected override async IAsyncEnumerable<Guid> GetGroups(Guid memberId) {
@@ -30,7 +30,7 @@ protected override async IAsyncEnumerable<Guid> GetGroups(Guid memberId) {
3030
}
3131
}
3232

33-
class StaticGroupMembership : GroupMembershipChecker {
33+
sealed class StaticGroupMembership : GroupMembershipChecker {
3434
private readonly IReadOnlyDictionary<Guid, IReadOnlyList<Guid>> _memberships;
3535
public StaticGroupMembership(IDictionary<Guid, Guid[]> memberships) {
3636
_memberships = memberships.ToDictionary(kvp => kvp.Key, kvp => (IReadOnlyList<Guid>)kvp.Value.ToList());

src/ApiService/ApiService/Log.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public interface ILog {
6161
void Flush();
6262
}
6363

64-
class AppInsights : ILog {
64+
sealed class AppInsights : ILog {
6565
private readonly TelemetryClient _telemetryClient;
6666

6767
public AppInsights(TelemetryClient client) {
@@ -128,7 +128,7 @@ public void Flush() {
128128
}
129129

130130
//TODO: Should we write errors and Exception to std err ?
131-
class Console : ILog {
131+
sealed class Console : ILog {
132132

133133
private static string DictToString<T>(IReadOnlyDictionary<string, T>? d) {
134134
if (d is null) {

src/ApiService/ApiService/OneFuzzTypes/Events.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ TaskConfig Config
122122

123123

124124
[EventType(EventType.JobCreated)]
125-
record EventJobCreated(
125+
sealed record EventJobCreated(
126126
Guid JobId,
127127
JobConfig Config,
128128
UserInfo? UserInfo
@@ -146,7 +146,7 @@ List<JobTaskStopped> TaskInfo
146146

147147

148148
[EventType(EventType.TaskCreated)]
149-
record EventTaskCreated(
149+
sealed record EventTaskCreated(
150150
Guid JobId,
151151
Guid TaskId,
152152
TaskConfig Config,
@@ -177,7 +177,7 @@ Guid PingId
177177

178178

179179
[EventType(EventType.ScalesetCreated)]
180-
record EventScalesetCreated(
180+
sealed record EventScalesetCreated(
181181
Guid ScalesetId,
182182
PoolName PoolName,
183183
string VmSku,
@@ -187,15 +187,15 @@ record EventScalesetCreated(
187187

188188

189189
[EventType(EventType.ScalesetFailed)]
190-
public record EventScalesetFailed(
190+
public sealed record EventScalesetFailed(
191191
Guid ScalesetId,
192192
PoolName PoolName,
193193
Error Error
194194
) : BaseEvent();
195195

196196

197197
[EventType(EventType.ScalesetDeleted)]
198-
record EventScalesetDeleted(
198+
sealed record EventScalesetDeleted(
199199
Guid ScalesetId,
200200
PoolName PoolName
201201

@@ -211,13 +211,13 @@ long size
211211

212212

213213
[EventType(EventType.PoolDeleted)]
214-
record EventPoolDeleted(
214+
sealed record EventPoolDeleted(
215215
PoolName PoolName
216216
) : BaseEvent();
217217

218218

219219
[EventType(EventType.PoolCreated)]
220-
record EventPoolCreated(
220+
sealed record EventPoolCreated(
221221
PoolName PoolName,
222222
Os Os,
223223
Architecture Arch,
@@ -289,7 +289,7 @@ ScalesetState State
289289
) : BaseEvent();
290290

291291
[EventType(EventType.NodeStateUpdated)]
292-
record EventNodeStateUpdated(
292+
sealed record EventNodeStateUpdated(
293293
Guid MachineId,
294294
Guid? ScalesetId,
295295
PoolName PoolName,

src/ApiService/ApiService/TestHooks/NodeOperationsTestHooks.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#if DEBUG
1111
namespace ApiService.TestHooks {
1212

13-
record MarkTasks(Node node, Error? error);
13+
sealed record MarkTasks(Node node, Error? error);
1414

1515
public class NodeOperationsTestHooks {
1616
private readonly ILogTracer _log;
@@ -162,8 +162,8 @@ public async Task<HttpResponseData> SearchStates([HttpTrigger(AuthorizationLevel
162162
Guid? scaleSetId = UriExtension.GetGuid("scaleSetId", query);
163163

164164
List<NodeState>? states = default;
165-
if (query.ContainsKey("states")) {
166-
states = query["states"].Split('-').Select(s => Enum.Parse<NodeState>(s)).ToList();
165+
if (query.TryGetValue("states", out var value)) {
166+
states = value.Split('-').Select(s => Enum.Parse<NodeState>(s)).ToList();
167167
}
168168
string? poolNameString = UriExtension.GetString("poolName", query);
169169

@@ -214,8 +214,8 @@ public async Task<HttpResponseData> CreateNode([HttpTrigger(AuthorizationLevel.A
214214
Guid machineId = Guid.Parse(query["machineId"]);
215215

216216
Guid? scaleSetId = default;
217-
if (query.ContainsKey("scaleSetId")) {
218-
scaleSetId = Guid.Parse(query["scaleSetId"]);
217+
if (query.TryGetValue("scaleSetId", out var value)) {
218+
scaleSetId = Guid.Parse(value);
219219
}
220220

221221
string version = query["version"];

src/ApiService/ApiService/TestHooks/UriExtension.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ from cs in queryComponents
1515

1616
public static bool GetBool(string key, IDictionary<string, string> query, bool defaultValue = false) {
1717
bool v;
18-
if (query.ContainsKey(key)) {
19-
v = bool.Parse(query[key]);
18+
if (query.TryGetValue(key, out var value)) {
19+
v = bool.Parse(value);
2020
} else {
2121
v = defaultValue;
2222
}
@@ -25,8 +25,8 @@ public static bool GetBool(string key, IDictionary<string, string> query, bool d
2525

2626
public static int? GetInt(string key, IDictionary<string, string> query, int? defaultValue = null) {
2727
int? v;
28-
if (query.ContainsKey(key)) {
29-
v = int.Parse(query[key]);
28+
if (query.TryGetValue(key, out var value)) {
29+
v = int.Parse(value);
3030
} else {
3131
v = defaultValue;
3232
}
@@ -35,16 +35,16 @@ public static bool GetBool(string key, IDictionary<string, string> query, bool d
3535

3636

3737
public static string? GetString(string key, IDictionary<string, string> query, string? defaultValue = null) {
38-
if (query.ContainsKey(key)) {
39-
return query[key];
38+
if (query.TryGetValue(key, out var value)) {
39+
return value;
4040
} else {
4141
return defaultValue;
4242
}
4343
}
4444

4545
public static Guid? GetGuid(string key, IDictionary<string, string> query, Guid? defaultValue = null) {
46-
if (query.ContainsKey(key)) {
47-
return Guid.Parse(query[key]);
46+
if (query.TryGetValue(key, out var value)) {
47+
return Guid.Parse(value);
4848
} else {
4949
return defaultValue;
5050
}

src/ApiService/ApiService/onefuzzlib/Config.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,7 @@ private async Task<ResultVoid<TaskConfigError>> CheckContainers(TaskDefinition d
505505
}
506506

507507
private static ResultVoid<TaskConfigError> CheckContainer(Compare compare, long expected, ContainerType containerType, Dictionary<ContainerType, List<Container>> containers) {
508-
var actual = containers.ContainsKey(containerType) ? containers[containerType].Count : 0;
509-
508+
var actual = containers.TryGetValue(containerType, out var v) ? v.Count : 0;
510509
if (!CheckVal(compare, expected, actual)) {
511510
return ResultVoid<TaskConfigError>.Error(
512511
new TaskConfigError($"container type {containerType}: expected {compare} {expected}, got {actual}"));

src/ApiService/ApiService/onefuzzlib/Creds.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public Task<IReadOnlyList<Region>> GetRegions()
159159
}
160160

161161

162-
class GraphQueryException : Exception {
162+
sealed class GraphQueryException : Exception {
163163
public GraphQueryException(string? message) : base(message) {
164164
}
165165
}

src/ApiService/ApiService/onefuzzlib/Extension.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public static VMExtensionWrapper AzSecExtension(AzureLocation region) {
130130
};
131131
}
132132

133-
private class Settings {
133+
private sealed class Settings {
134134
[JsonPropertyName("GCS_AUTO_CONFIG")]
135135
public bool GCS_AUTO_CONFIG { get; set; } = true;
136136
}

src/ApiService/ApiService/onefuzzlib/ImageOperations.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public ImageOperations(ILogTracer logTracer, IOnefuzzContext context, IMemoryCac
3939
_cache = cache;
4040
}
4141

42-
record class GetOsKey(Region Region, string Image);
42+
sealed record class GetOsKey(Region Region, string Image);
4343

4444
public Task<OneFuzzResult<Os>> GetOs(Region region, string image)
4545
=> _cache.GetOrCreateAsync<OneFuzzResult<Os>>(new GetOsKey(region, image), entry => GetOsInternal(region, image));

src/ApiService/ApiService/onefuzzlib/IpOperations.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,16 +232,16 @@ public async Async.Task CreateIp(string resourceGroup, string name, Region regio
232232
/// the api does not seems to support this :
233233
/// https://github.com/Azure/azure-sdk-for-net/issues/30253#issuecomment-1202447362
234234
/// </summary>
235-
class NetworkInterfaceQuery {
236-
record IpConfigurationsProperties(string privateIPAddress);
235+
sealed class NetworkInterfaceQuery {
236+
sealed record IpConfigurationsProperties(string privateIPAddress);
237237

238-
record IpConfigurations(IpConfigurationsProperties properties);
238+
sealed record IpConfigurations(IpConfigurationsProperties properties);
239239

240-
record NetworkInterfaceProperties(List<IpConfigurations> ipConfigurations);
240+
sealed record NetworkInterfaceProperties(List<IpConfigurations> ipConfigurations);
241241

242-
record NetworkInterface(NetworkInterfaceProperties properties);
242+
sealed record NetworkInterface(NetworkInterfaceProperties properties);
243243

244-
record ValueList<T>(List<T> value);
244+
sealed record ValueList<T>(List<T> value);
245245

246246
private readonly IOnefuzzContext _context;
247247

0 commit comments

Comments
 (0)