From bd3a1bbfdf43b5a4d06e6730dab51dac90c0c28b Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Thu, 3 Aug 2023 10:53:32 -0700 Subject: [PATCH 01/14] Update Ardalis.GuardClauses Signed-off-by: Victor Chang --- src/Api/Rest/InferenceRequest.cs | 14 +- src/Api/Storage/DicomFileStorageMetadata.cs | 10 +- src/Api/Storage/FhirFileStorageMetadata.cs | 6 +- src/Api/Storage/FileStorageMetadata.cs | 6 +- src/Api/Storage/Hl7FileStorageMetadata.cs | 2 +- src/Api/Storage/Payload.cs | 4 +- src/Api/Storage/StorageObjectMetadata.cs | 10 +- src/Api/Test/packages.lock.json | 14 +- src/Api/packages.lock.json | 14 +- src/CLI/Commands/AetCommand.cs | 14 +- src/CLI/Commands/CommandBase.cs | 10 +- src/CLI/Commands/ConfigCommand.cs | 8 +- src/CLI/Commands/DestinationCommand.cs | 20 +- src/CLI/Commands/RestartCommand.cs | 2 +- src/CLI/Commands/SourceCommand.cs | 16 +- src/CLI/Commands/StartCommand.cs | 2 +- src/CLI/Commands/StatusCommand.cs | 2 +- src/CLI/Commands/StopCommand.cs | 2 +- src/CLI/ControlException.cs | 2 +- src/CLI/Logging/ConsoleLogger.cs | 2 +- .../Logging/ConsoleLoggerFactoryExtensions.cs | 2 +- src/CLI/Services/ConfirmationPrompt.cs | 2 +- src/CLI/Services/DockerRunner.cs | 10 +- src/CLI/Services/EmbeddedResource.cs | 2 +- src/CLI/Test/packages.lock.json | 16 +- src/CLI/packages.lock.json | 16 +- ...oy.InformaticsGateway.Client.Common.csproj | 2 +- src/Client.Common/ProblemException.cs | 2 +- ...formaticsGateway.Client.Common.Test.csproj | 2 +- src/Client.Common/Test/packages.lock.json | 16 +- src/Client.Common/packages.lock.json | 14 +- src/Client/Services/AeTitle{T}Service.cs | 14 +- src/Client/Services/HealthService.cs | 2 +- src/Client/Test/packages.lock.json | 182 +++++++++--------- src/Client/packages.lock.json | 16 +- ...ai.Deploy.InformaticsGateway.Common.csproj | 2 +- src/Common/Test/packages.lock.json | 14 +- src/Common/packages.lock.json | 14 +- src/Configuration/Test/packages.lock.json | 14 +- src/Configuration/ValidationExtensions.cs | 12 +- src/Configuration/packages.lock.json | 14 +- .../InferenceRequestRepositoryBase.cs | 6 +- .../StorageMetadataRepositoryBase.cs | 10 +- src/Database/Api/StorageMetadataWrapper.cs | 4 +- src/Database/Api/Test/packages.lock.json | 14 +- src/Database/Api/packages.lock.json | 14 +- .../DestinationApplicationEntityRepository.cs | 12 +- .../DicomAssociationInfoRepository.cs | 6 +- .../InferenceRequestRepository.cs | 10 +- .../MonaiApplicationEntityRepository.cs | 12 +- .../Repositories/PayloadRepository.cs | 10 +- .../SourceApplicationEntityRepository.cs | 14 +- .../StorageMetadataWrapperRepository.cs | 16 +- .../EntityFramework/Test/packages.lock.json | 14 +- .../EntityFramework/packages.lock.json | 14 +- .../Integration.Test/packages.lock.json | 14 +- .../DestinationApplicationEntityRepository.cs | 14 +- .../DicomAssociationInfoRepository.cs | 8 +- .../InferenceRequestRepository.cs | 10 +- .../MonaiApplicationEntityRepository.cs | 14 +- .../MongoDB/Repositories/PayloadRepository.cs | 12 +- .../SourceApplicationEntityRepository.cs | 14 +- .../StorageMetadataWrapperRepository.cs | 16 +- src/Database/MongoDB/packages.lock.json | 14 +- src/Database/packages.lock.json | 14 +- src/DicomWebClient/CLI/Qido.cs | 8 +- src/DicomWebClient/CLI/Stow.cs | 2 +- src/DicomWebClient/CLI/Utils.cs | 34 ++-- src/DicomWebClient/CLI/Wado.cs | 16 +- src/DicomWebClient/CLI/packages.lock.json | 16 +- .../Common/HttpResponseMessageExtension.cs | 8 +- src/DicomWebClient/DicomWebClient.cs | 6 +- ....InformaticsGateway.DicomWeb.Client.csproj | 2 +- src/DicomWebClient/Services/QidoService.cs | 6 +- src/DicomWebClient/Services/ServiceBase.cs | 2 +- src/DicomWebClient/Services/StowService.cs | 2 +- src/DicomWebClient/Services/WadoService.cs | 32 +-- ...rmaticsGateway.DicomWeb.Client.Test.csproj | 2 +- src/DicomWebClient/Test/packages.lock.json | 18 +- src/DicomWebClient/packages.lock.json | 16 +- .../Common/DicomExtensions.cs | 2 +- src/InformaticsGateway/Common/DicomToolkit.cs | 7 +- .../Common/FileStorageMetadataExtensions.cs | 15 +- .../Logging/FoDicomLogManager.cs | 2 +- .../Logging/MicrosoftLoggerAdapter.cs | 3 +- .../Monai.Deploy.InformaticsGateway.csproj | 2 +- .../Repositories/MonaiServiceLocator.cs | 2 +- .../Services/Common/ITcpListener.cs | 2 +- .../Connectors/DataRetrievalService.cs | 78 ++++---- .../Services/Connectors/PayloadAssembler.cs | 2 +- .../Connectors/PayloadMoveActionHandler.cs | 12 +- .../PayloadNotificationActionHandler.cs | 10 +- .../Connectors/PayloadNotificationService.cs | 10 +- .../DicomWeb/DicomInstanceReaderBase.cs | 6 +- .../Services/DicomWeb/IStreamsWriter.cs | 14 +- .../DicomWeb/MultipartDicomInstanceReader.cs | 4 +- .../DicomWeb/SingleDicomInstanceReader.cs | 4 +- .../Services/DicomWeb/StowService.cs | 6 +- .../Services/Export/DicomWebExportService.cs | 8 +- .../Export/ExportRequestDataMessage.cs | 4 +- .../Services/Export/ExportServiceBase.cs | 2 +- .../Services/Export/ScuExportService.cs | 2 +- .../Services/Fhir/FhirJsonReader.cs | 8 +- .../Fhir/FhirResourceTypesRouteConstraint.cs | 9 +- .../Services/Fhir/FhirService.cs | 6 +- .../Services/Fhir/FhirXmlReader.cs | 10 +- .../Services/HealthLevel7/MllpClient.cs | 8 +- .../Services/HealthLevel7/MllpService.cs | 5 +- .../Services/Http/InferenceController.cs | 5 +- .../Services/Http/MonaiAeTitleController.cs | 3 +- .../Services/Scp/ApplicationEntityHandler.cs | 17 +- .../Services/Scp/ApplicationEntityManager.cs | 9 +- .../Scp/MonaiAeChangedNotificationService.cs | 5 +- .../Services/Scp/ScpService.cs | 8 +- .../Services/Scu/ScuQueue.cs | 2 +- .../Services/Scu/ScuService.cs | 4 +- .../Services/Scu/ScuWorkRequest.cs | 6 +- .../Services/Storage/ObjectUploadQueue.cs | 2 +- .../Services/Storage/ObjectUploadService.cs | 10 +- .../Export/DicomWebExportServiceTest.cs | 2 +- .../Services/Export/ScuExportServiceTest.cs | 2 +- .../Test/packages.lock.json | 20 +- src/InformaticsGateway/packages.lock.json | 20 +- tests/Integration.Test/Common/Assertions.cs | 20 +- tests/Integration.Test/Common/DataProvider.cs | 4 +- .../Common/DicomCEchoDataClient.cs | 2 +- .../Common/DicomCStoreDataClient.cs | 2 +- .../Common/DicomWebDataSink.cs | 4 +- tests/Integration.Test/Common/FhirDataSink.cs | 2 +- tests/Integration.Test/Common/Hl7DataSink.cs | 4 +- .../Drivers/EfDataProvider.cs | 2 +- .../DicomDimseScpServicesStepDefinitions.cs | 30 +-- .../DicomWebStowServiceStepDefinitions.cs | 10 +- .../ExportServicesStepDefinitions.cs | 6 +- .../StepDefinitions/FhirDefinitions.cs | 4 +- .../HealthLevel7Definitions.cs | 2 +- .../StepDefinitions/SharedDefinitions.cs | 6 +- tests/Integration.Test/packages.lock.json | 20 +- 138 files changed, 635 insertions(+), 825 deletions(-) diff --git a/src/Api/Rest/InferenceRequest.cs b/src/Api/Rest/InferenceRequest.cs index cca4558a3..1a271f41f 100644 --- a/src/Api/Rest/InferenceRequest.cs +++ b/src/Api/Rest/InferenceRequest.cs @@ -230,7 +230,7 @@ private bool Validate(out string details) private void ValidateOUtputResources(List errors) { - Guard.Against.Null(errors); + Guard.Against.Null(errors, nameof(errors)); if (InputMetadata is not null && InputMetadata.Inputs.IsNullOrEmpty()) { @@ -247,7 +247,7 @@ private void ValidateOUtputResources(List errors) private void ValidateInputMetadata(List errors) { - Guard.Against.Null(errors); + Guard.Against.Null(errors, nameof(errors)); foreach (var output in OutputResources ?? Enumerable.Empty()) { @@ -264,7 +264,7 @@ private void ValidateInputMetadata(List errors) private void ValidateInputResources(List errors) { - Guard.Against.Null(errors); + Guard.Against.Null(errors, nameof(errors)); if (InputResources.IsNullOrEmpty() || !InputResources!.Any(predicate => predicate.Interface != InputInterfaceType.Algorithm)) @@ -319,8 +319,8 @@ private static void CheckInputMetadataDetails(InferenceRequestDetails details, L private static void CheckInputMetadataWithTypeFhirResource(InferenceRequestDetails details, List errors) { - Guard.Against.Null(details); - Guard.Against.Null(errors); + Guard.Against.Null(details, nameof(details)); + Guard.Against.Null(errors, nameof(errors)); if (details.Resources.IsNullOrEmpty()) { @@ -334,8 +334,8 @@ private static void CheckInputMetadataWithTypeFhirResource(InferenceRequestDetai private static void CheckInputMetadataWithTypDicomUid(InferenceRequestDetails details, List errors) { - Guard.Against.Null(details); - Guard.Against.Null(errors); + Guard.Against.Null(details, nameof(details)); + Guard.Against.Null(errors, nameof(errors)); if (details.Studies.IsNullOrEmpty()) { diff --git a/src/Api/Storage/DicomFileStorageMetadata.cs b/src/Api/Storage/DicomFileStorageMetadata.cs index da8dbccd7..2c3dfd17f 100644 --- a/src/Api/Storage/DicomFileStorageMetadata.cs +++ b/src/Api/Storage/DicomFileStorageMetadata.cs @@ -98,11 +98,11 @@ public DicomFileStorageMetadata() { } public DicomFileStorageMetadata(string associationId, string identifier, string studyInstanceUid, string seriesInstanceUid, string sopInstanceUid) : base(associationId.ToString(), identifier) { - Guard.Against.NullOrWhiteSpace(associationId); - Guard.Against.NullOrWhiteSpace(identifier); - Guard.Against.NullOrWhiteSpace(studyInstanceUid); - Guard.Against.NullOrWhiteSpace(seriesInstanceUid); - Guard.Against.NullOrWhiteSpace(sopInstanceUid); + Guard.Against.NullOrWhiteSpace(associationId, nameof(associationId)); + Guard.Against.NullOrWhiteSpace(identifier, nameof(identifier)); + Guard.Against.NullOrWhiteSpace(identifier, nameof(identifier)); + Guard.Against.NullOrWhiteSpace(identifier, nameof(identifier)); + Guard.Against.NullOrWhiteSpace(identifier, nameof(identifier)); StudyInstanceUid = studyInstanceUid; SeriesInstanceUid = seriesInstanceUid; diff --git a/src/Api/Storage/FhirFileStorageMetadata.cs b/src/Api/Storage/FhirFileStorageMetadata.cs index 91907e505..425ef0626 100644 --- a/src/Api/Storage/FhirFileStorageMetadata.cs +++ b/src/Api/Storage/FhirFileStorageMetadata.cs @@ -69,9 +69,9 @@ public FhirFileStorageMetadata() { } public FhirFileStorageMetadata(string transactionId, string resourceType, string resourceId, FhirStorageFormat fhirFileFormat) : base(transactionId, $"{resourceType}{PathSeparator}{resourceId}") { - Guard.Against.NullOrWhiteSpace(transactionId); - Guard.Against.NullOrWhiteSpace(resourceType); - Guard.Against.NullOrWhiteSpace(resourceId); + Guard.Against.NullOrWhiteSpace(transactionId, nameof(transactionId)); + Guard.Against.NullOrWhiteSpace(resourceType, nameof(resourceType)); + Guard.Against.NullOrWhiteSpace(resourceId, nameof(resourceId)); Source = transactionId; ResourceType = resourceType; diff --git a/src/Api/Storage/FileStorageMetadata.cs b/src/Api/Storage/FileStorageMetadata.cs index ec3e3b310..e24ecb170 100644 --- a/src/Api/Storage/FileStorageMetadata.cs +++ b/src/Api/Storage/FileStorageMetadata.cs @@ -92,8 +92,8 @@ protected FileStorageMetadata() { } protected FileStorageMetadata(string correlationId, string identifier) { - Guard.Against.NullOrWhiteSpace(correlationId); - Guard.Against.NullOrWhiteSpace(identifier); + Guard.Against.NullOrWhiteSpace(correlationId, nameof(correlationId)); + Guard.Against.NullOrWhiteSpace(identifier, nameof(identifier)); CorrelationId = correlationId; Id = identifier; @@ -107,7 +107,7 @@ protected FileStorageMetadata(string correlationId, string identifier) /// List of workflows. public void SetWorkflows(params string[] workflows) { - Guard.Against.NullOrEmpty(workflows); + Guard.Against.NullOrEmpty(workflows, nameof(workflows)); Workflows.AddRange(workflows); } diff --git a/src/Api/Storage/Hl7FileStorageMetadata.cs b/src/Api/Storage/Hl7FileStorageMetadata.cs index 1d9c8ce48..2eaf4a5ef 100644 --- a/src/Api/Storage/Hl7FileStorageMetadata.cs +++ b/src/Api/Storage/Hl7FileStorageMetadata.cs @@ -48,7 +48,7 @@ public Hl7FileStorageMetadata() { } public Hl7FileStorageMetadata(string connectionId) : base(connectionId, Guid.NewGuid().ToString()) { - Guard.Against.NullOrWhiteSpace(connectionId); + Guard.Against.NullOrWhiteSpace(connectionId, nameof(connectionId)); Source = connectionId; diff --git a/src/Api/Storage/Payload.cs b/src/Api/Storage/Payload.cs index cc305a67d..df0e859e9 100644 --- a/src/Api/Storage/Payload.cs +++ b/src/Api/Storage/Payload.cs @@ -81,7 +81,7 @@ public TimeSpan Elapsed public Payload(string key, string correlationId, uint timeout) { - Guard.Against.NullOrWhiteSpace(key); + Guard.Against.NullOrWhiteSpace(key, nameof(key)); Files = new List(); _lastReceived = new Stopwatch(); @@ -98,7 +98,7 @@ public Payload(string key, string correlationId, uint timeout) public void Add(FileStorageMetadata value) { - Guard.Against.Null(value); + Guard.Against.Null(value, nameof(value)); Files.Add(value); _lastReceived.Reset(); diff --git a/src/Api/Storage/StorageObjectMetadata.cs b/src/Api/Storage/StorageObjectMetadata.cs index 27c4399eb..1c1df2303 100644 --- a/src/Api/Storage/StorageObjectMetadata.cs +++ b/src/Api/Storage/StorageObjectMetadata.cs @@ -90,7 +90,7 @@ public class StorageObjectMetadata public StorageObjectMetadata(string fileExtension) { - Guard.Against.NullOrWhiteSpace(fileExtension); + Guard.Against.NullOrWhiteSpace(fileExtension, nameof(fileExtension)); if (fileExtension[0] != '.') { @@ -103,20 +103,20 @@ public StorageObjectMetadata(string fileExtension) public string GetTempStoragPath(string rootPath) { - Guard.Against.NullOrWhiteSpace(rootPath); + Guard.Against.NullOrWhiteSpace(rootPath, nameof(rootPath)); return $"{rootPath}{FileStorageMetadata.PathSeparator}{TemporaryPath}"; } public string GetPayloadPath(Guid payloadId) { - Guard.Against.Null(payloadId); + Guard.Against.Null(payloadId, nameof(payloadId)); return $"{payloadId}{FileStorageMetadata.PathSeparator}{UploadPath}"; } public void SetUploaded(string bucketName) { - Guard.Against.NullOrWhiteSpace(bucketName); + Guard.Against.NullOrWhiteSpace(bucketName, nameof(bucketName)); TemporaryBucketName = bucketName; DateUploaded = DateTime.UtcNow; @@ -155,7 +155,7 @@ public void SetFailed() public void SetMoved(string bucketName) { - Guard.Against.NullOrEmpty(bucketName); + Guard.Against.NullOrEmpty(bucketName, nameof(bucketName)); PayloadBucketName = bucketName; DateMoved = DateTime.UtcNow; diff --git a/src/Api/Test/packages.lock.json b/src/Api/Test/packages.lock.json index fb65e89a2..8fc44c745 100644 --- a/src/Api/Test/packages.lock.json +++ b/src/Api/Test/packages.lock.json @@ -55,11 +55,8 @@ }, "Ardalis.GuardClauses": { "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "AWSSDK.Core": { "type": "Transitive", @@ -90,11 +87,6 @@ "System.Threading.Channels": "6.0.0" } }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Macross.Json.Extensions": { "type": "Transitive", "resolved": "3.0.0", @@ -1277,7 +1269,7 @@ "monai.deploy.informaticsgateway.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.IO.Abstractions": "[17.2.3, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )", "fo-dicom": "[5.0.3, )" diff --git a/src/Api/packages.lock.json b/src/Api/packages.lock.json index bf469152e..56db093b4 100644 --- a/src/Api/packages.lock.json +++ b/src/Api/packages.lock.json @@ -46,11 +46,8 @@ }, "Ardalis.GuardClauses": { "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "AWSSDK.Core": { "type": "Transitive", @@ -81,11 +78,6 @@ "System.Threading.Channels": "6.0.0" } }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Microsoft.Bcl.AsyncInterfaces": { "type": "Transitive", "resolved": "1.1.1", @@ -273,7 +265,7 @@ "monai.deploy.informaticsgateway.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.IO.Abstractions": "[17.2.3, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )", "fo-dicom": "[5.0.3, )" diff --git a/src/CLI/Commands/AetCommand.cs b/src/CLI/Commands/AetCommand.cs index 8d8c4a0e0..829330a18 100644 --- a/src/CLI/Commands/AetCommand.cs +++ b/src/CLI/Commands/AetCommand.cs @@ -148,7 +148,7 @@ private void SetupEditAetCommand() private async Task ListAeTitlehandlerAsync(IHost host, bool verbose, CancellationToken cancellationToken) { - Guard.Against.Null(host); + Guard.Against.Null(host, nameof(host)); LogVerbose(verbose, host, "Configuring services..."); @@ -216,8 +216,8 @@ private async Task ListAeTitlehandlerAsync(IHost host, bool verbose, Cancel private async Task RemoveAeTitlehandlerAsync(string name, IHost host, bool verbose, CancellationToken cancellationToken) { - Guard.Against.NullOrWhiteSpace(name); - Guard.Against.Null(host); + Guard.Against.NullOrWhiteSpace(name, nameof(name)); + Guard.Against.Null(host, nameof(host)); LogVerbose(verbose, host, "Configuring services..."); var configService = host.Services.GetRequiredService(); @@ -252,8 +252,8 @@ private async Task RemoveAeTitlehandlerAsync(string name, IHost host, bool private async Task AddAeTitlehandlerAsync(MonaiApplicationEntity entity, IHost host, bool verbose, CancellationToken cancellationToken) { - Guard.Against.Null(entity); - Guard.Against.Null(host); + Guard.Against.Null(entity, nameof(entity)); + Guard.Against.Null(host, nameof(host)); LogVerbose(verbose, host, "Configuring services..."); var configService = host.Services.GetRequiredService(); @@ -304,8 +304,8 @@ private async Task AddAeTitlehandlerAsync(MonaiApplicationEntity entity, IH private async Task EditAeTitleHandlerAsync(MonaiApplicationEntity entity, IHost host, bool verbose, CancellationToken cancellationToken) { - Guard.Against.Null(entity); - Guard.Against.Null(host); + Guard.Against.Null(entity, nameof(entity)); + Guard.Against.Null(host, nameof(host)); LogVerbose(verbose, host, "Configuring services..."); var configService = host.Services.GetRequiredService(); diff --git a/src/CLI/Commands/CommandBase.cs b/src/CLI/Commands/CommandBase.cs index 8748a37c0..1bbff414a 100644 --- a/src/CLI/Commands/CommandBase.cs +++ b/src/CLI/Commands/CommandBase.cs @@ -33,7 +33,7 @@ public CommandBase(string name, string description) : base(name, description) protected static ILogger CreateLogger(IHost host) { - Guard.Against.Null(host); + Guard.Against.Null(host, nameof(host)); var loggerFactory = host.Services.GetService(); return loggerFactory?.CreateLogger(); @@ -41,8 +41,8 @@ protected static ILogger CreateLogger(IHost host) protected static void LogVerbose(bool verbose, IHost host, string message) { - Guard.Against.Null(host); - Guard.Against.NullOrWhiteSpace(message); + Guard.Against.Null(host, nameof(host)); + Guard.Against.NullOrWhiteSpace(message, nameof(message)); if (verbose) { @@ -62,7 +62,7 @@ protected static void LogVerbose(bool verbose, IHost host, string message) protected static void AddConfirmationOption(Command command) { - Guard.Against.Null(command); + Guard.Against.Null(command, nameof(command)); var confirmationOption = new Option(new[] { "-y", "--yes" }, "Automatic yes to prompts"); command.AddOption(confirmationOption); @@ -70,7 +70,7 @@ protected static void AddConfirmationOption(Command command) protected static void CheckConfiguration(IConfigurationService configService) { - Guard.Against.Null(configService); + Guard.Against.Null(configService, nameof(configService)); if (!configService.IsInitialized) { diff --git a/src/CLI/Commands/ConfigCommand.cs b/src/CLI/Commands/ConfigCommand.cs index 51323b372..43e805418 100644 --- a/src/CLI/Commands/ConfigCommand.cs +++ b/src/CLI/Commands/ConfigCommand.cs @@ -84,7 +84,7 @@ private void SetupShowConfigCommand() private int ShowConfigurationHandler(IHost host, bool verbose, CancellationToken cancellationToken) { - Guard.Against.Null(host); + Guard.Against.Null(host, nameof(host)); LogVerbose(verbose, host, "Configuring services..."); var logger = CreateLogger(host); @@ -114,8 +114,8 @@ private int ShowConfigurationHandler(IHost host, bool verbose, CancellationToken private static int ConfigUpdateHandler(IHost host, Action updater) { - Guard.Against.Null(host); - Guard.Against.Null(updater); + Guard.Against.Null(host, nameof(host)); + Guard.Against.Null(updater, nameof(updater)); var logger = CreateLogger(host); var config = host.Services.GetRequiredService(); @@ -143,7 +143,7 @@ private static int ConfigUpdateHandler(IHost host, Action private async Task InitHandlerAsync(IHost host, bool verbose, bool yes, CancellationToken cancellationToken) { - Guard.Against.Null(host); + Guard.Against.Null(host, nameof(host)); var logger = CreateLogger(host); var configService = host.Services.GetRequiredService(); diff --git a/src/CLI/Commands/DestinationCommand.cs b/src/CLI/Commands/DestinationCommand.cs index 6e8239a87..044000b8f 100644 --- a/src/CLI/Commands/DestinationCommand.cs +++ b/src/CLI/Commands/DestinationCommand.cs @@ -116,8 +116,8 @@ private void SetupAddDestinationCommand() private async Task ListDestinationHandlerAsync(DestinationApplicationEntity entity, IHost host, bool verbose, CancellationToken cancellationToken) { - Guard.Against.Null(entity); - Guard.Against.Null(host); + Guard.Against.Null(entity, nameof(entity)); + Guard.Against.Null(host, nameof(host)); LogVerbose(verbose, host, "Configuring services..."); @@ -182,8 +182,8 @@ private async Task ListDestinationHandlerAsync(DestinationApplicationEntity private async Task CEchoDestinationHandlerAsync(string name, IHost host, bool verbose, CancellationToken cancellationToken) { - Guard.Against.NullOrWhiteSpace(name); - Guard.Against.Null(host); + Guard.Against.NullOrWhiteSpace(name, nameof(name)); + Guard.Against.Null(host, nameof(host)); LogVerbose(verbose, host, "Configuring services..."); var configService = host.Services.GetRequiredService(); @@ -218,8 +218,8 @@ private async Task CEchoDestinationHandlerAsync(string name, IHost host, bo private async Task RemoveDestinationHandlerAsync(string name, IHost host, bool verbose, CancellationToken cancellationToken) { - Guard.Against.NullOrWhiteSpace(name); - Guard.Against.Null(host); + Guard.Against.NullOrWhiteSpace(name, nameof(name)); + Guard.Against.Null(host, nameof(host)); LogVerbose(verbose, host, "Configuring services..."); var configService = host.Services.GetRequiredService(); @@ -254,8 +254,8 @@ private async Task RemoveDestinationHandlerAsync(string name, IHost host, b private async Task EditDestinationHandlerAsync(DestinationApplicationEntity entity, IHost host, bool verbose, CancellationToken cancellationToken) { - Guard.Against.Null(entity); - Guard.Against.Null(host); + Guard.Against.Null(entity, nameof(entity)); + Guard.Against.Null(host, nameof(host)); LogVerbose(verbose, host, "Configuring services..."); var configService = host.Services.GetRequiredService(); @@ -292,8 +292,8 @@ private async Task EditDestinationHandlerAsync(DestinationApplicationEntity private async Task AddDestinationHandlerAsync(DestinationApplicationEntity entity, IHost host, bool verbose, CancellationToken cancellationToken) { - Guard.Against.Null(entity); - Guard.Against.Null(host); + Guard.Against.Null(entity, nameof(entity)); + Guard.Against.Null(host, nameof(host)); LogVerbose(verbose, host, "Configuring services..."); var configService = host.Services.GetRequiredService(); diff --git a/src/CLI/Commands/RestartCommand.cs b/src/CLI/Commands/RestartCommand.cs index c9d06653d..ba9cc479f 100644 --- a/src/CLI/Commands/RestartCommand.cs +++ b/src/CLI/Commands/RestartCommand.cs @@ -35,7 +35,7 @@ public RestartCommand() : base("restart", $"Restart the {Strings.ApplicationName private async Task RestartCommandHandler(IHost host, bool yes, bool verbose, CancellationToken cancellationToken) { - Guard.Against.Null(host); + Guard.Against.Null(host, nameof(host)); var service = host.Services.GetRequiredService(); var confirmation = host.Services.GetRequiredService(); diff --git a/src/CLI/Commands/SourceCommand.cs b/src/CLI/Commands/SourceCommand.cs index 096aa5945..2a2f27dd1 100644 --- a/src/CLI/Commands/SourceCommand.cs +++ b/src/CLI/Commands/SourceCommand.cs @@ -98,8 +98,8 @@ private void SetupUpdateSourceCommand() private async Task ListSourceHandlerAsync(SourceApplicationEntity entity, IHost host, bool verbose, CancellationToken cancellationTokena) { - Guard.Against.Null(entity); - Guard.Against.Null(host); + Guard.Against.Null(entity, nameof(entity)); + Guard.Against.Null(host, nameof(host)); LogVerbose(verbose, host, "Configuring services..."); @@ -163,8 +163,8 @@ private async Task ListSourceHandlerAsync(SourceApplicationEntity entity, I private async Task RemoveSourceHandlerAsync(string name, IHost host, bool verbose, CancellationToken cancellationTokena) { - Guard.Against.NullOrWhiteSpace(name); - Guard.Against.Null(host); + Guard.Against.NullOrWhiteSpace(name, nameof(name)); + Guard.Against.Null(host, nameof(host)); LogVerbose(verbose, host, "Configuring services..."); var configService = host.Services.GetRequiredService(); @@ -199,8 +199,8 @@ private async Task RemoveSourceHandlerAsync(string name, IHost host, bool v private async Task AddSourceHandlerAsync(SourceApplicationEntity entity, IHost host, bool verbose, CancellationToken cancellationTokena) { - Guard.Against.Null(entity); - Guard.Against.Null(host); + Guard.Against.Null(entity, nameof(entity)); + Guard.Against.Null(host, nameof(host)); LogVerbose(verbose, host, "Configuring services..."); var configService = host.Services.GetRequiredService(); @@ -236,8 +236,8 @@ private async Task AddSourceHandlerAsync(SourceApplicationEntity entity, IH private async Task UpdateSourceHandlerAsync(SourceApplicationEntity entity, IHost host, bool verbose, CancellationToken cancellationTokena) { - Guard.Against.Null(entity); - Guard.Against.Null(host); + Guard.Against.Null(entity, nameof(entity)); + Guard.Against.Null(host, nameof(host)); LogVerbose(verbose, host, "Configuring services..."); var configService = host.Services.GetRequiredService(); diff --git a/src/CLI/Commands/StartCommand.cs b/src/CLI/Commands/StartCommand.cs index 3ceb4c574..c59545b6a 100644 --- a/src/CLI/Commands/StartCommand.cs +++ b/src/CLI/Commands/StartCommand.cs @@ -35,7 +35,7 @@ public StartCommand() : base("start", $"Start the {Strings.ApplicationName} serv private async Task StartCommandHandler(IHost host, bool verbose, CancellationToken cancellationToken) { - Guard.Against.Null(host); + Guard.Against.Null(host, nameof(host)); var service = host.Services.GetRequiredService(); var confirmation = host.Services.GetRequiredService(); diff --git a/src/CLI/Commands/StatusCommand.cs b/src/CLI/Commands/StatusCommand.cs index 23cf0fb0a..b64573b71 100644 --- a/src/CLI/Commands/StatusCommand.cs +++ b/src/CLI/Commands/StatusCommand.cs @@ -36,7 +36,7 @@ public StatusCommand() : base("status", $"{Strings.ApplicationName} service stat private async Task StatusCommandHandlerAsync(IHost host, bool verbose, CancellationToken cancellationToken) { - Guard.Against.Null(host); + Guard.Against.Null(host, nameof(host)); LogVerbose(verbose, host, "Configuring services..."); diff --git a/src/CLI/Commands/StopCommand.cs b/src/CLI/Commands/StopCommand.cs index 51a031ca1..2b4eef74f 100644 --- a/src/CLI/Commands/StopCommand.cs +++ b/src/CLI/Commands/StopCommand.cs @@ -35,7 +35,7 @@ public StopCommand() : base("stop", $"Stop the {Strings.ApplicationName} service private async Task StopCommandHandler(IHost host, bool yes, bool verbose, CancellationToken cancellationToken) { - Guard.Against.Null(host); + Guard.Against.Null(host, nameof(host)); var service = host.Services.GetRequiredService(); var confirmation = host.Services.GetRequiredService(); diff --git a/src/CLI/ControlException.cs b/src/CLI/ControlException.cs index 35f9152da..02f27f045 100644 --- a/src/CLI/ControlException.cs +++ b/src/CLI/ControlException.cs @@ -49,7 +49,7 @@ protected ControlException(SerializationInfo info, StreamingContext context) : b public override void GetObjectData(SerializationInfo info, StreamingContext context) { - Guard.Against.Null(info); + Guard.Against.Null(info, nameof(info)); info.AddValue(nameof(ErrorCode), ErrorCode); diff --git a/src/CLI/Logging/ConsoleLogger.cs b/src/CLI/Logging/ConsoleLogger.cs index 38c4f1472..0b6c25a9c 100644 --- a/src/CLI/Logging/ConsoleLogger.cs +++ b/src/CLI/Logging/ConsoleLogger.cs @@ -27,7 +27,7 @@ public class ConsoleLogger : ILogger public ConsoleLogger(string name, ConsoleLoggerConfiguration configuration) { - Guard.Against.NullOrWhiteSpace(name); + Guard.Against.NullOrWhiteSpace(name, nameof(name)); _ = name; _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); diff --git a/src/CLI/Logging/ConsoleLoggerFactoryExtensions.cs b/src/CLI/Logging/ConsoleLoggerFactoryExtensions.cs index 818118b18..5536b23c5 100644 --- a/src/CLI/Logging/ConsoleLoggerFactoryExtensions.cs +++ b/src/CLI/Logging/ConsoleLoggerFactoryExtensions.cs @@ -32,7 +32,7 @@ public static class ConsoleLoggerFactoryExtensions { public static ILoggingBuilder AddInformaticsGatewayConsole(this ILoggingBuilder builder, Action configure) { - Guard.Against.Null(configure); + Guard.Against.Null(configure, nameof(configure)); builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton()); LoggerProviderOptions.RegisterProviderOptions(builder.Services); diff --git a/src/CLI/Services/ConfirmationPrompt.cs b/src/CLI/Services/ConfirmationPrompt.cs index 156f2c7ce..bcef296a7 100644 --- a/src/CLI/Services/ConfirmationPrompt.cs +++ b/src/CLI/Services/ConfirmationPrompt.cs @@ -28,7 +28,7 @@ internal class ConfirmationPrompt : IConfirmationPrompt { public bool ShowConfirmationPrompt(string message) { - Guard.Against.NullOrWhiteSpace(message); + Guard.Against.NullOrWhiteSpace(message, nameof(message)); Console.Write($"{message} [y/N]: "); var key = Console.ReadKey(); diff --git a/src/CLI/Services/DockerRunner.cs b/src/CLI/Services/DockerRunner.cs index 41bf03d2a..20d1c15a0 100644 --- a/src/CLI/Services/DockerRunner.cs +++ b/src/CLI/Services/DockerRunner.cs @@ -45,7 +45,7 @@ public DockerRunner(ILogger logger, IConfigurationService configur public async Task IsApplicationRunning(ImageVersion imageVersion, CancellationToken cancellationToken = default) { - Guard.Against.Null(imageVersion); + Guard.Against.Null(imageVersion, nameof(imageVersion)); _logger.CheckingExistingAppContainer(Strings.ApplicationName, imageVersion.Version); var parameters = new ContainersListParameters @@ -72,7 +72,7 @@ public async Task GetLatestApplicationVersion(CancellationToken ca public async Task GetLatestApplicationVersion(string version, CancellationToken cancellationToken = default) { - Guard.Against.NullOrWhiteSpace(version); + Guard.Against.NullOrWhiteSpace(version, nameof(version)); var results = await GetApplicationVersions(version, cancellationToken).ConfigureAwait(false); return results?.OrderByDescending(p => p.Created).FirstOrDefault(); @@ -83,7 +83,7 @@ public async Task> GetApplicationVersions(CancellationToken public async Task> GetApplicationVersions(string version, CancellationToken cancellationToken = default) { - Guard.Against.NullOrWhiteSpace(version); + Guard.Against.NullOrWhiteSpace(version, nameof(version)); _logger.ConnectingToDocker(); var parameters = new ImagesListParameters @@ -103,7 +103,7 @@ public async Task> GetApplicationVersions(string version, Ca public async Task StartApplication(ImageVersion imageVersion, CancellationToken cancellationToken = default) { - Guard.Against.Null(imageVersion); + Guard.Against.Null(imageVersion, nameof(imageVersion)); _logger.CreatingDockerContainer(Strings.ApplicationName, imageVersion.Version, imageVersion.IdShort); var createContainerParams = new CreateContainerParameters @@ -168,7 +168,7 @@ public async Task StartApplication(ImageVersion imageVersion, Cancellation public async Task StopApplication(RunnerState runnerState, CancellationToken cancellationToken = default) { - Guard.Against.Null(runnerState); + Guard.Against.Null(runnerState, nameof(runnerState)); _logger.DockerContainerStopping(Strings.ApplicationName, runnerState.IdShort); var result = await _dockerClient.Containers.StopContainerAsync(runnerState.Id, new ContainerStopParameters() { WaitBeforeKillSeconds = 60 }, cancellationToken).ConfigureAwait(false); diff --git a/src/CLI/Services/EmbeddedResource.cs b/src/CLI/Services/EmbeddedResource.cs index b723e2bee..9b21c127e 100644 --- a/src/CLI/Services/EmbeddedResource.cs +++ b/src/CLI/Services/EmbeddedResource.cs @@ -28,7 +28,7 @@ public class EmbeddedResource : IEmbeddedResource { public Stream GetManifestResourceStream(string name) { - Guard.Against.NullOrWhiteSpace(name); + Guard.Against.NullOrWhiteSpace(name, nameof(name)); return GetType().Assembly.GetManifestResourceStream(Common.AppSettingsResourceName); } } diff --git a/src/CLI/Test/packages.lock.json b/src/CLI/Test/packages.lock.json index 0cacb4101..181a6eca1 100644 --- a/src/CLI/Test/packages.lock.json +++ b/src/CLI/Test/packages.lock.json @@ -75,11 +75,8 @@ }, "Ardalis.GuardClauses": { "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "AWSSDK.Core": { "type": "Transitive", @@ -133,11 +130,6 @@ "System.Threading.Channels": "6.0.0" } }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Macross.Json.Extensions": { "type": "Transitive", "resolved": "3.0.0", @@ -1589,14 +1581,14 @@ "monai.deploy.informaticsgateway.client.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.Text.Json": "[6.0.7, )" } }, "monai.deploy.informaticsgateway.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.IO.Abstractions": "[17.2.3, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )", "fo-dicom": "[5.0.3, )" diff --git a/src/CLI/packages.lock.json b/src/CLI/packages.lock.json index b511d9ff1..c3f413be8 100644 --- a/src/CLI/packages.lock.json +++ b/src/CLI/packages.lock.json @@ -110,11 +110,8 @@ }, "Ardalis.GuardClauses": { "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "AWSSDK.Core": { "type": "Transitive", @@ -145,11 +142,6 @@ "System.Threading.Channels": "6.0.0" } }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Macross.Json.Extensions": { "type": "Transitive", "resolved": "3.0.0", @@ -1434,14 +1426,14 @@ "monai.deploy.informaticsgateway.client.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.Text.Json": "[6.0.7, )" } }, "monai.deploy.informaticsgateway.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.IO.Abstractions": "[17.2.3, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )", "fo-dicom": "[5.0.3, )" diff --git a/src/Client.Common/Monai.Deploy.InformaticsGateway.Client.Common.csproj b/src/Client.Common/Monai.Deploy.InformaticsGateway.Client.Common.csproj index feae9df5a..47c85ed67 100644 --- a/src/Client.Common/Monai.Deploy.InformaticsGateway.Client.Common.csproj +++ b/src/Client.Common/Monai.Deploy.InformaticsGateway.Client.Common.csproj @@ -28,7 +28,7 @@ - + diff --git a/src/Client.Common/ProblemException.cs b/src/Client.Common/ProblemException.cs index 81989b0f7..c3f1e0b08 100644 --- a/src/Client.Common/ProblemException.cs +++ b/src/Client.Common/ProblemException.cs @@ -28,7 +28,7 @@ public class ProblemException : Exception public ProblemException(ProblemDetails problemDetails) : base(problemDetails?.Detail) { - Guard.Against.Null(problemDetails); + Guard.Against.Null(problemDetails, nameof(problemDetails)); ProblemDetails = problemDetails; } diff --git a/src/Client.Common/Test/Monai.Deploy.InformaticsGateway.Client.Common.Test.csproj b/src/Client.Common/Test/Monai.Deploy.InformaticsGateway.Client.Common.Test.csproj index ec3803e7e..3c990613d 100644 --- a/src/Client.Common/Test/Monai.Deploy.InformaticsGateway.Client.Common.Test.csproj +++ b/src/Client.Common/Test/Monai.Deploy.InformaticsGateway.Client.Common.Test.csproj @@ -26,7 +26,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Client.Common/Test/packages.lock.json b/src/Client.Common/Test/packages.lock.json index fcdbbac9b..043b6e568 100644 --- a/src/Client.Common/Test/packages.lock.json +++ b/src/Client.Common/Test/packages.lock.json @@ -4,12 +4,9 @@ "net6.0": { "Ardalis.GuardClauses": { "type": "Direct", - "requested": "[4.0.1, )", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "requested": "[4.1.1, )", + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "coverlet.collector": { "type": "Direct", @@ -70,11 +67,6 @@ "System.Diagnostics.EventLog": "6.0.0" } }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Microsoft.CodeCoverage": { "type": "Transitive", "resolved": "17.5.0", @@ -1086,7 +1078,7 @@ "monai.deploy.informaticsgateway.client.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.Text.Json": "[6.0.7, )" } } diff --git a/src/Client.Common/packages.lock.json b/src/Client.Common/packages.lock.json index e3b5be2b0..65b399a69 100644 --- a/src/Client.Common/packages.lock.json +++ b/src/Client.Common/packages.lock.json @@ -4,12 +4,9 @@ "net6.0": { "Ardalis.GuardClauses": { "type": "Direct", - "requested": "[4.0.1, )", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "requested": "[4.1.1, )", + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "System.Text.Json": { "type": "Direct", @@ -21,11 +18,6 @@ "System.Text.Encodings.Web": "6.0.0" } }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "System.Runtime.CompilerServices.Unsafe": { "type": "Transitive", "resolved": "6.0.0", diff --git a/src/Client/Services/AeTitle{T}Service.cs b/src/Client/Services/AeTitle{T}Service.cs index e804cc1be..45f5779c5 100644 --- a/src/Client/Services/AeTitle{T}Service.cs +++ b/src/Client/Services/AeTitle{T}Service.cs @@ -49,15 +49,15 @@ internal class AeTitleService : ServiceBase, IAeTitleService public AeTitleService(string route, HttpClient httpClient, ILogger logger = null) : base(httpClient, logger) { - Guard.Against.NullOrWhiteSpace(route); - Guard.Against.Null(httpClient); + Guard.Against.NullOrWhiteSpace(route, nameof(route)); + Guard.Against.Null(httpClient, nameof(httpClient)); Route = route; } public async Task Create(T item, CancellationToken cancellationToken) { - Guard.Against.Null(item); + Guard.Against.Null(item, nameof(item)); Logger.SendingRequestTo(Route); var response = await HttpClient.PostAsJsonAsync(Route, item, Configuration.JsonSerializationOptions, cancellationToken).ConfigureAwait(false); @@ -68,7 +68,7 @@ public async Task Create(T item, CancellationToken cancellationToken) public async Task Delete(string aeTitle, CancellationToken cancellationToken) { aeTitle = Uri.EscapeDataString(aeTitle); - Guard.Against.NullOrWhiteSpace(aeTitle); + Guard.Against.NullOrWhiteSpace(aeTitle, nameof(aeTitle)); Logger.SendingRequestTo($"{Route}/{aeTitle}"); var response = await HttpClient.DeleteAsync($"{Route}/{aeTitle}", cancellationToken).ConfigureAwait(false); await response.EnsureSuccessStatusCodeWithProblemDetails(Logger).ConfigureAwait(false); @@ -78,7 +78,7 @@ public async Task Delete(string aeTitle, CancellationToken cancellationToken) public async Task GetAeTitle(string aeTitle, CancellationToken cancellationToken) { aeTitle = Uri.EscapeDataString(aeTitle); - Guard.Against.NullOrWhiteSpace(aeTitle); + Guard.Against.NullOrWhiteSpace(aeTitle, nameof(aeTitle)); Logger.SendingRequestTo($"{Route}/{aeTitle}"); var response = await HttpClient.GetAsync($"{Route}/{aeTitle}", cancellationToken).ConfigureAwait(false); await response.EnsureSuccessStatusCodeWithProblemDetails(Logger).ConfigureAwait(false); @@ -101,7 +101,7 @@ public async Task CEcho(string name, CancellationToken cancellationToken) throw new NotSupportedException($"C-ECHO is not supported for {typeof(T).Name}"); } name = Uri.EscapeDataString(name); - Guard.Against.NullOrWhiteSpace(name); + Guard.Against.NullOrWhiteSpace(name, nameof(name)); Logger.SendingRequestTo($"{Route}/{name}"); var response = await HttpClient.GetAsync($"{Route}/cecho/{name}", cancellationToken).ConfigureAwait(false); await response.EnsureSuccessStatusCodeWithProblemDetails(Logger).ConfigureAwait(false); @@ -109,7 +109,7 @@ public async Task CEcho(string name, CancellationToken cancellationToken) public async Task Update(T item, CancellationToken cancellationToken) { - Guard.Against.Null(item); + Guard.Against.Null(item, nameof(item)); Logger.SendingRequestTo(Route); var response = await HttpClient.PutAsJsonAsync(Route, item, Configuration.JsonSerializationOptions, cancellationToken).ConfigureAwait(false); diff --git a/src/Client/Services/HealthService.cs b/src/Client/Services/HealthService.cs index 7b7a5b4ab..1d9be5472 100644 --- a/src/Client/Services/HealthService.cs +++ b/src/Client/Services/HealthService.cs @@ -39,7 +39,7 @@ internal class HealthService : ServiceBase, IHealthService public HealthService(HttpClient httpClient, ILogger logger = null) : base(httpClient, logger) { - Guard.Against.Null(httpClient); + Guard.Against.Null(httpClient, nameof(httpClient)); } public async Task Live(CancellationToken cancellationToken) => await LiveReady("live", cancellationToken).ConfigureAwait(false); diff --git a/src/Client/Test/packages.lock.json b/src/Client/Test/packages.lock.json index cb1f838a6..28e9456b9 100644 --- a/src/Client/Test/packages.lock.json +++ b/src/Client/Test/packages.lock.json @@ -46,11 +46,8 @@ }, "Ardalis.GuardClauses": { "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "AspNetCore.HealthChecks.MongoDb": { "type": "Transitive", @@ -145,11 +142,6 @@ "resolved": "2.35.0", "contentHash": "1yScq0Ju2O/GPBasnr9/uHziKu3CBgh4nOkgJPWatPLTcP4EzUjjaM2hkgjOBMj8pKO0g687UDnj989MvYRLfA==" }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Karambolo.Extensions.Logging.File": { "type": "Transitive", "resolved": "3.4.0", @@ -1669,141 +1661,141 @@ "monai.deploy.informaticsgateway": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "4.0.1", - "DotNext.Threading": "4.7.4", - "HL7-dotnetcore": "2.35.0", - "Karambolo.Extensions.Logging.File": "3.4.0", - "Microsoft.EntityFrameworkCore": "6.0.15", - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions": "6.0.15", - "Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore": "6.0.15", - "Microsoft.Extensions.Hosting": "6.0.1", - "Microsoft.Extensions.Logging": "6.0.0", - "Microsoft.Extensions.Logging.Console": "6.0.0", - "Microsoft.Extensions.Options": "6.0.0", - "Monai.Deploy.InformaticsGateway.Api": "1.0.0", - "Monai.Deploy.InformaticsGateway.Common": "1.0.0", - "Monai.Deploy.InformaticsGateway.Configuration": "1.0.0", - "Monai.Deploy.InformaticsGateway.Database": "1.0.0", - "Monai.Deploy.InformaticsGateway.Database.Api": "1.0.0", - "Monai.Deploy.InformaticsGateway.Database.EntityFramework": "1.0.0", - "Monai.Deploy.InformaticsGateway.DicomWeb.Client": "1.0.0", - "Monai.Deploy.Messaging.RabbitMQ": "0.1.22", - "Monai.Deploy.Security": "0.1.3", - "Monai.Deploy.Storage": "0.2.16", - "Monai.Deploy.Storage.MinIO": "0.2.16", - "NLog": "5.1.3", - "NLog.Web.AspNetCore": "5.2.3", - "Polly": "7.2.3", - "Swashbuckle.AspNetCore": "6.5.0", - "fo-dicom": "5.0.3", - "fo-dicom.NLog": "5.0.3" + "Ardalis.GuardClauses": "[4.1.1, )", + "DotNext.Threading": "[4.7.4, )", + "HL7-dotnetcore": "[2.35.0, )", + "Karambolo.Extensions.Logging.File": "[3.4.0, )", + "Microsoft.EntityFrameworkCore": "[6.0.15, )", + "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", + "Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions": "[6.0.15, )", + "Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore": "[6.0.15, )", + "Microsoft.Extensions.Hosting": "[6.0.1, )", + "Microsoft.Extensions.Logging": "[6.0.0, )", + "Microsoft.Extensions.Logging.Console": "[6.0.0, )", + "Microsoft.Extensions.Options": "[6.0.0, )", + "Monai.Deploy.InformaticsGateway.Api": "[1.0.0, )", + "Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )", + "Monai.Deploy.InformaticsGateway.Configuration": "[1.0.0, )", + "Monai.Deploy.InformaticsGateway.Database": "[1.0.0, )", + "Monai.Deploy.InformaticsGateway.Database.Api": "[1.0.0, )", + "Monai.Deploy.InformaticsGateway.Database.EntityFramework": "[1.0.0, )", + "Monai.Deploy.InformaticsGateway.DicomWeb.Client": "[1.0.0, )", + "Monai.Deploy.Messaging.RabbitMQ": "[0.1.22, )", + "Monai.Deploy.Security": "[0.1.3, )", + "Monai.Deploy.Storage": "[0.2.16, )", + "Monai.Deploy.Storage.MinIO": "[0.2.16, )", + "NLog": "[5.1.3, )", + "NLog.Web.AspNetCore": "[5.2.3, )", + "Polly": "[7.2.3, )", + "Swashbuckle.AspNetCore": "[6.5.0, )", + "fo-dicom": "[5.0.3, )", + "fo-dicom.NLog": "[5.0.3, )" } }, "monai.deploy.informaticsgateway.api": { "type": "Project", "dependencies": { - "Macross.Json.Extensions": "3.0.0", - "Microsoft.EntityFrameworkCore.Abstractions": "6.0.15", - "Monai.Deploy.InformaticsGateway.Common": "1.0.0", - "Monai.Deploy.Messaging": "0.1.22", - "Monai.Deploy.Storage": "0.2.16" + "Macross.Json.Extensions": "[3.0.0, )", + "Microsoft.EntityFrameworkCore.Abstractions": "[6.0.15, )", + "Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )", + "Monai.Deploy.Messaging": "[0.1.22, )", + "Monai.Deploy.Storage": "[0.2.16, )" } }, "monai.deploy.informaticsgateway.client": { "type": "Project", "dependencies": { - "Microsoft.AspNet.WebApi.Client": "5.2.9", - "Microsoft.Extensions.Http": "6.0.0", - "Monai.Deploy.InformaticsGateway.Api": "1.0.0", - "Monai.Deploy.InformaticsGateway.Client.Common": "1.0.0" + "Microsoft.AspNet.WebApi.Client": "[5.2.9, )", + "Microsoft.Extensions.Http": "[6.0.0, )", + "Monai.Deploy.InformaticsGateway.Api": "[1.0.0, )", + "Monai.Deploy.InformaticsGateway.Client.Common": "[1.0.0, )" } }, "monai.deploy.informaticsgateway.client.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "4.0.1", - "System.Text.Json": "6.0.7" + "Ardalis.GuardClauses": "[4.1.1, )", + "System.Text.Json": "[6.0.7, )" } }, "monai.deploy.informaticsgateway.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "4.0.1", - "System.IO.Abstractions": "17.2.3", - "System.Threading.Tasks.Dataflow": "6.0.0", - "fo-dicom": "5.0.3" + "Ardalis.GuardClauses": "[4.1.1, )", + "System.IO.Abstractions": "[17.2.3, )", + "System.Threading.Tasks.Dataflow": "[6.0.0, )", + "fo-dicom": "[5.0.3, )" } }, "monai.deploy.informaticsgateway.configuration": { "type": "Project", "dependencies": { - "Microsoft.Extensions.Logging.Abstractions": "6.0.3", - "Microsoft.Extensions.Options": "6.0.0", - "Monai.Deploy.InformaticsGateway.Api": "1.0.0", - "Monai.Deploy.InformaticsGateway.Common": "1.0.0", - "Monai.Deploy.Messaging": "0.1.22", - "Monai.Deploy.Storage": "0.2.16", - "System.IO.Abstractions": "17.2.3" + "Microsoft.Extensions.Logging.Abstractions": "[6.0.3, )", + "Microsoft.Extensions.Options": "[6.0.0, )", + "Monai.Deploy.InformaticsGateway.Api": "[1.0.0, )", + "Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )", + "Monai.Deploy.Messaging": "[0.1.22, )", + "Monai.Deploy.Storage": "[0.2.16, )", + "System.IO.Abstractions": "[17.2.3, )" } }, "monai.deploy.informaticsgateway.database": { "type": "Project", "dependencies": { - "AspNetCore.HealthChecks.MongoDb": "6.0.2", - "Microsoft.EntityFrameworkCore": "6.0.15", - "Microsoft.Extensions.Configuration": "6.0.1", - "Microsoft.Extensions.Configuration.FileExtensions": "6.0.0", - "Microsoft.Extensions.Configuration.Json": "6.0.0", - "Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore": "6.0.15", - "Microsoft.Extensions.Options.ConfigurationExtensions": "6.0.0", - "Monai.Deploy.InformaticsGateway.Api": "1.0.0", - "Monai.Deploy.InformaticsGateway.Configuration": "1.0.0", - "Monai.Deploy.InformaticsGateway.Database.Api": "1.0.0", - "Monai.Deploy.InformaticsGateway.Database.EntityFramework": "1.0.0", - "Monai.Deploy.InformaticsGateway.Database.MongoDB": "1.0.0" + "AspNetCore.HealthChecks.MongoDb": "[6.0.2, )", + "Microsoft.EntityFrameworkCore": "[6.0.15, )", + "Microsoft.Extensions.Configuration": "[6.0.1, )", + "Microsoft.Extensions.Configuration.FileExtensions": "[6.0.0, )", + "Microsoft.Extensions.Configuration.Json": "[6.0.0, )", + "Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore": "[6.0.15, )", + "Microsoft.Extensions.Options.ConfigurationExtensions": "[6.0.0, )", + "Monai.Deploy.InformaticsGateway.Api": "[1.0.0, )", + "Monai.Deploy.InformaticsGateway.Configuration": "[1.0.0, )", + "Monai.Deploy.InformaticsGateway.Database.Api": "[1.0.0, )", + "Monai.Deploy.InformaticsGateway.Database.EntityFramework": "[1.0.0, )", + "Monai.Deploy.InformaticsGateway.Database.MongoDB": "[1.0.0, )" } }, "monai.deploy.informaticsgateway.database.api": { "type": "Project", "dependencies": { - "Microsoft.EntityFrameworkCore": "6.0.15", - "Monai.Deploy.InformaticsGateway.Api": "1.0.0", - "Monai.Deploy.InformaticsGateway.Configuration": "1.0.0", - "Polly": "7.2.3" + "Microsoft.EntityFrameworkCore": "[6.0.15, )", + "Monai.Deploy.InformaticsGateway.Api": "[1.0.0, )", + "Monai.Deploy.InformaticsGateway.Configuration": "[1.0.0, )", + "Polly": "[7.2.3, )" } }, "monai.deploy.informaticsgateway.database.entityframework": { "type": "Project", "dependencies": { - "Microsoft.EntityFrameworkCore": "6.0.15", - "Microsoft.EntityFrameworkCore.Sqlite": "6.0.15", - "Microsoft.Extensions.Configuration": "6.0.1", - "Microsoft.Extensions.Configuration.FileExtensions": "6.0.0", - "Microsoft.Extensions.Configuration.Json": "6.0.0", - "Monai.Deploy.InformaticsGateway.Api": "1.0.0", - "Monai.Deploy.InformaticsGateway.Configuration": "1.0.0", - "Monai.Deploy.InformaticsGateway.Database.Api": "1.0.0" + "Microsoft.EntityFrameworkCore": "[6.0.15, )", + "Microsoft.EntityFrameworkCore.Sqlite": "[6.0.15, )", + "Microsoft.Extensions.Configuration": "[6.0.1, )", + "Microsoft.Extensions.Configuration.FileExtensions": "[6.0.0, )", + "Microsoft.Extensions.Configuration.Json": "[6.0.0, )", + "Monai.Deploy.InformaticsGateway.Api": "[1.0.0, )", + "Monai.Deploy.InformaticsGateway.Configuration": "[1.0.0, )", + "Monai.Deploy.InformaticsGateway.Database.Api": "[1.0.0, )" } }, "monai.deploy.informaticsgateway.database.mongodb": { "type": "Project", "dependencies": { - "Monai.Deploy.InformaticsGateway.Database.Api": "1.0.0", - "MongoDB.Driver": "2.19.1", - "MongoDB.Driver.Core": "2.19.1" + "Monai.Deploy.InformaticsGateway.Database.Api": "[1.0.0, )", + "MongoDB.Driver": "[2.19.1, )", + "MongoDB.Driver.Core": "[2.19.1, )" } }, "monai.deploy.informaticsgateway.dicomweb.client": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "4.0.1", - "Microsoft.AspNet.WebApi.Client": "5.2.9", - "Microsoft.Extensions.Http": "6.0.0", - "Microsoft.Net.Http.Headers": "2.2.8", - "Monai.Deploy.InformaticsGateway.Client.Common": "1.0.0", - "System.Linq.Async": "6.0.1", - "fo-dicom": "5.0.3" + "Ardalis.GuardClauses": "[4.1.1, )", + "Microsoft.AspNet.WebApi.Client": "[5.2.9, )", + "Microsoft.Extensions.Http": "[6.0.0, )", + "Microsoft.Net.Http.Headers": "[2.2.8, )", + "Monai.Deploy.InformaticsGateway.Client.Common": "[1.0.0, )", + "System.Linq.Async": "[6.0.1, )", + "fo-dicom": "[5.0.3, )" } } } diff --git a/src/Client/packages.lock.json b/src/Client/packages.lock.json index dafb40686..b08b1d9c1 100644 --- a/src/Client/packages.lock.json +++ b/src/Client/packages.lock.json @@ -26,11 +26,8 @@ }, "Ardalis.GuardClauses": { "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "AWSSDK.Core": { "type": "Transitive", @@ -61,11 +58,6 @@ "System.Threading.Channels": "6.0.0" } }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Macross.Json.Extensions": { "type": "Transitive", "resolved": "3.0.0", @@ -1186,14 +1178,14 @@ "monai.deploy.informaticsgateway.client.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.Text.Json": "[6.0.7, )" } }, "monai.deploy.informaticsgateway.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.IO.Abstractions": "[17.2.3, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )", "fo-dicom": "[5.0.3, )" diff --git a/src/Common/Monai.Deploy.InformaticsGateway.Common.csproj b/src/Common/Monai.Deploy.InformaticsGateway.Common.csproj index d3215d280..751b2d2ee 100644 --- a/src/Common/Monai.Deploy.InformaticsGateway.Common.csproj +++ b/src/Common/Monai.Deploy.InformaticsGateway.Common.csproj @@ -29,7 +29,7 @@ - + diff --git a/src/Common/Test/packages.lock.json b/src/Common/Test/packages.lock.json index b5fab6aab..5caca4b78 100644 --- a/src/Common/Test/packages.lock.json +++ b/src/Common/Test/packages.lock.json @@ -61,11 +61,8 @@ }, "Ardalis.GuardClauses": { "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "Castle.Core": { "type": "Transitive", @@ -91,11 +88,6 @@ "System.Threading.Channels": "6.0.0" } }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Microsoft.Bcl.AsyncInterfaces": { "type": "Transitive", "resolved": "1.1.1", @@ -1163,7 +1155,7 @@ "monai.deploy.informaticsgateway.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.IO.Abstractions": "[17.2.3, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )", "fo-dicom": "[5.0.3, )" diff --git a/src/Common/packages.lock.json b/src/Common/packages.lock.json index b25f865a0..d41f8e893 100644 --- a/src/Common/packages.lock.json +++ b/src/Common/packages.lock.json @@ -4,12 +4,9 @@ "net6.0": { "Ardalis.GuardClauses": { "type": "Direct", - "requested": "[4.0.1, )", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "requested": "[4.1.1, )", + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "fo-dicom": { "type": "Direct", @@ -40,11 +37,6 @@ "resolved": "6.0.0", "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Microsoft.Bcl.AsyncInterfaces": { "type": "Transitive", "resolved": "1.1.1", diff --git a/src/Configuration/Test/packages.lock.json b/src/Configuration/Test/packages.lock.json index 6d012e0f0..da075823f 100644 --- a/src/Configuration/Test/packages.lock.json +++ b/src/Configuration/Test/packages.lock.json @@ -55,11 +55,8 @@ }, "Ardalis.GuardClauses": { "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "AWSSDK.Core": { "type": "Transitive", @@ -98,11 +95,6 @@ "System.Threading.Channels": "6.0.0" } }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Macross.Json.Extensions": { "type": "Transitive", "resolved": "3.0.0", @@ -1290,7 +1282,7 @@ "monai.deploy.informaticsgateway.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.IO.Abstractions": "[17.2.3, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )", "fo-dicom": "[5.0.3, )" diff --git a/src/Configuration/ValidationExtensions.cs b/src/Configuration/ValidationExtensions.cs index e136a7572..bcd76f378 100644 --- a/src/Configuration/ValidationExtensions.cs +++ b/src/Configuration/ValidationExtensions.cs @@ -30,7 +30,7 @@ public static class ValidationExtensions public static bool IsValid(this MonaiApplicationEntity monaiApplicationEntity, out IList validationErrors) { - Guard.Against.Null(monaiApplicationEntity); + Guard.Against.Null(monaiApplicationEntity, nameof(monaiApplicationEntity)); validationErrors = new List(); @@ -43,7 +43,7 @@ public static bool IsValid(this MonaiApplicationEntity monaiApplicationEntity, o public static bool IsValid(this DestinationApplicationEntity destinationApplicationEntity, out IList validationErrors) { - Guard.Against.Null(destinationApplicationEntity); + Guard.Against.Null(destinationApplicationEntity, nameof(destinationApplicationEntity)); validationErrors = new List(); @@ -58,7 +58,7 @@ public static bool IsValid(this DestinationApplicationEntity destinationApplicat public static bool IsValid(this SourceApplicationEntity sourceApplicationEntity, out IList validationErrors) { - Guard.Against.Null(sourceApplicationEntity); + Guard.Against.Null(sourceApplicationEntity, nameof(sourceApplicationEntity)); validationErrors = new List(); @@ -71,7 +71,7 @@ public static bool IsValid(this SourceApplicationEntity sourceApplicationEntity, public static bool IsValidDicomTag(string source, string grouping, IList validationErrors = null) { - Guard.Against.NullOrWhiteSpace(source); + Guard.Against.NullOrWhiteSpace(source, nameof(source)); try { @@ -93,7 +93,7 @@ public static bool IsValidDicomTag(string source, string grouping, IList public static bool IsAeTitleValid(string source, string aeTitle, IList validationErrors = null) { - Guard.Against.NullOrWhiteSpace(source); + Guard.Against.NullOrWhiteSpace(source, nameof(source)); if (!string.IsNullOrWhiteSpace(aeTitle) && aeTitle.Length <= 15 && @@ -121,7 +121,7 @@ public static bool IsValidHostNameIp(string source, string hostIp, IList public static bool IsPortValid(string source, int port, IList validationErrors = null) { - Guard.Against.NullOrWhiteSpace(source); + Guard.Against.NullOrWhiteSpace(source, nameof(source)); if (port > 0 && port <= 65535) return true; diff --git a/src/Configuration/packages.lock.json b/src/Configuration/packages.lock.json index 955303f12..5339382aa 100644 --- a/src/Configuration/packages.lock.json +++ b/src/Configuration/packages.lock.json @@ -56,11 +56,8 @@ }, "Ardalis.GuardClauses": { "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "AWSSDK.Core": { "type": "Transitive", @@ -91,11 +88,6 @@ "System.Threading.Channels": "6.0.0" } }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Macross.Json.Extensions": { "type": "Transitive", "resolved": "3.0.0", @@ -284,7 +276,7 @@ "monai.deploy.informaticsgateway.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.IO.Abstractions": "[17.2.3, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )", "fo-dicom": "[5.0.3, )" diff --git a/src/Database/Api/Repositories/InferenceRequestRepositoryBase.cs b/src/Database/Api/Repositories/InferenceRequestRepositoryBase.cs index cd0c8e6d1..38c1639c3 100644 --- a/src/Database/Api/Repositories/InferenceRequestRepositoryBase.cs +++ b/src/Database/Api/Repositories/InferenceRequestRepositoryBase.cs @@ -39,13 +39,13 @@ protected InferenceRequestRepositoryBase( public virtual async Task ExistsAsync(string transactionId, CancellationToken cancellationToken = default) { - Guard.Against.NullOrWhiteSpace(transactionId); + Guard.Against.NullOrWhiteSpace(transactionId, nameof(transactionId)); return await GetInferenceRequestAsync(transactionId, cancellationToken).ConfigureAwait(false) is not null; } public virtual async Task GetStatusAsync(string transactionId, CancellationToken cancellationToken = default) { - Guard.Against.NullOrWhiteSpace(transactionId); + Guard.Against.NullOrWhiteSpace(transactionId, nameof(transactionId)); var response = new InferenceStatusResponse(); var item = await GetInferenceRequestAsync(transactionId, cancellationToken).ConfigureAwait(false); @@ -61,7 +61,7 @@ public virtual async Task ExistsAsync(string transactionId, CancellationTo public async Task UpdateAsync(InferenceRequest inferenceRequest, InferenceRequestStatus status, CancellationToken cancellationToken = default) { - Guard.Against.Null(inferenceRequest); + Guard.Against.Null(inferenceRequest, nameof(inferenceRequest)); using var loggerScope = _logger.BeginScope(new LoggingDataDictionary { { "TransactionId", inferenceRequest.TransactionId } }); diff --git a/src/Database/Api/Repositories/StorageMetadataRepositoryBase.cs b/src/Database/Api/Repositories/StorageMetadataRepositoryBase.cs index 722487010..99edd04cf 100644 --- a/src/Database/Api/Repositories/StorageMetadataRepositoryBase.cs +++ b/src/Database/Api/Repositories/StorageMetadataRepositoryBase.cs @@ -33,7 +33,7 @@ protected StorageMetadataRepositoryBase(ILogger logger) public async Task AddAsync(FileStorageMetadata metadata, CancellationToken cancellationToken = default) { - Guard.Against.Null(metadata); + Guard.Against.Null(metadata, nameof(metadata)); using var loggerScope = _logger.BeginScope(new LoggingDataDictionary { { "CorrelationId", metadata.CorrelationId }, { "Identity", metadata.Id } }); var obj = new StorageMetadataWrapper(metadata); @@ -43,7 +43,7 @@ public async Task AddAsync(FileStorageMetadata metadata, CancellationToken cance public async Task AddOrUpdateAsync(FileStorageMetadata metadata, CancellationToken cancellationToken = default) { - Guard.Against.Null(metadata); + Guard.Against.Null(metadata, nameof(metadata)); var existing = await GetFileStorageMetdadataAsync(metadata.CorrelationId, metadata.Id, cancellationToken).ConfigureAwait(false); @@ -59,8 +59,8 @@ public async Task AddOrUpdateAsync(FileStorageMetadata metadata, CancellationTok public virtual async Task DeleteAsync(string correlationId, string identity, CancellationToken cancellationToken = default) { - Guard.Against.NullOrWhiteSpace(correlationId); - Guard.Against.NullOrWhiteSpace(identity); + Guard.Against.NullOrWhiteSpace(correlationId, nameof(correlationId)); + Guard.Against.NullOrWhiteSpace(identity, nameof(identity)); using var loggerScope = _logger.BeginScope(new LoggingDataDictionary { { "CorrelationId", correlationId }, { "Identity", identity } }); @@ -83,7 +83,7 @@ public virtual async Task DeleteAsync(string correlationId, string identit public virtual async Task UpdateAsync(FileStorageMetadata metadata, CancellationToken cancellationToken = default) { - Guard.Against.Null(metadata); + Guard.Against.Null(metadata, nameof(metadata)); using var loggerScope = _logger.BeginScope(new LoggingDataDictionary { { "CorrelationId", metadata.CorrelationId }, { "Identity", metadata.Id } }); var obj = await FindByIds(metadata.Id, metadata.CorrelationId).ConfigureAwait(false); diff --git a/src/Database/Api/StorageMetadataWrapper.cs b/src/Database/Api/StorageMetadataWrapper.cs index 63976d023..4258e738f 100644 --- a/src/Database/Api/StorageMetadataWrapper.cs +++ b/src/Database/Api/StorageMetadataWrapper.cs @@ -47,7 +47,7 @@ private StorageMetadataWrapper() public StorageMetadataWrapper(FileStorageMetadata metadata) { - Guard.Against.Null(metadata); + Guard.Against.Null(metadata, nameof(metadata)); CorrelationId = metadata.CorrelationId; Identity = metadata.Id; @@ -56,7 +56,7 @@ public StorageMetadataWrapper(FileStorageMetadata metadata) public void Update(FileStorageMetadata metadata) { - Guard.Against.Null(metadata); + Guard.Against.Null(metadata, nameof(metadata)); IsUploaded = metadata.IsUploaded; Value = JsonSerializer.Serialize(metadata); // Must be here diff --git a/src/Database/Api/Test/packages.lock.json b/src/Database/Api/Test/packages.lock.json index 94e0f6020..2199e7a4b 100644 --- a/src/Database/Api/Test/packages.lock.json +++ b/src/Database/Api/Test/packages.lock.json @@ -37,11 +37,8 @@ }, "Ardalis.GuardClauses": { "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "AWSSDK.Core": { "type": "Transitive", @@ -72,11 +69,6 @@ "System.Threading.Channels": "6.0.0" } }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Macross.Json.Extensions": { "type": "Transitive", "resolved": "3.0.0", @@ -1311,7 +1303,7 @@ "monai.deploy.informaticsgateway.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.IO.Abstractions": "[17.2.3, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )", "fo-dicom": "[5.0.3, )" diff --git a/src/Database/Api/packages.lock.json b/src/Database/Api/packages.lock.json index c9d55d740..9645e0f25 100644 --- a/src/Database/Api/packages.lock.json +++ b/src/Database/Api/packages.lock.json @@ -25,11 +25,8 @@ }, "Ardalis.GuardClauses": { "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "AWSSDK.Core": { "type": "Transitive", @@ -60,11 +57,6 @@ "System.Threading.Channels": "6.0.0" } }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Macross.Json.Extensions": { "type": "Transitive", "resolved": "3.0.0", @@ -333,7 +325,7 @@ "monai.deploy.informaticsgateway.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.IO.Abstractions": "[17.2.3, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )", "fo-dicom": "[5.0.3, )" diff --git a/src/Database/EntityFramework/Repositories/DestinationApplicationEntityRepository.cs b/src/Database/EntityFramework/Repositories/DestinationApplicationEntityRepository.cs index 182ccee0e..5209ece7b 100644 --- a/src/Database/EntityFramework/Repositories/DestinationApplicationEntityRepository.cs +++ b/src/Database/EntityFramework/Repositories/DestinationApplicationEntityRepository.cs @@ -43,8 +43,8 @@ public DestinationApplicationEntityRepository( ILogger logger, IOptions options) { - Guard.Against.Null(serviceScopeFactory); - Guard.Against.Null(options); + Guard.Against.Null(serviceScopeFactory, nameof(serviceScopeFactory)); + Guard.Against.Null(options, nameof(options)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); @@ -58,7 +58,7 @@ public DestinationApplicationEntityRepository( public async Task AddAsync(DestinationApplicationEntity item, CancellationToken cancellationToken = default) { - Guard.Against.Null(item); + Guard.Against.Null(item, nameof(item)); return await _retryPolicy.ExecuteAsync(async () => { @@ -79,7 +79,7 @@ public async Task ContainsAsync(Expression FindByNameAsync(string name, CancellationToken cancellationToken = default) { - Guard.Against.NullOrWhiteSpace(name); + Guard.Against.NullOrWhiteSpace(name, nameof(name)); return await _retryPolicy.ExecuteAsync(async () => { @@ -89,7 +89,7 @@ public async Task ContainsAsync(Expression RemoveAsync(DestinationApplicationEntity entity, CancellationToken cancellationToken = default) { - Guard.Against.Null(entity); + Guard.Against.Null(entity, nameof(entity)); return await _retryPolicy.ExecuteAsync(async () => { @@ -109,7 +109,7 @@ public async Task> ToListAsync(CancellationTo public async Task UpdateAsync(DestinationApplicationEntity entity, CancellationToken cancellationToken = default) { - Guard.Against.Null(entity); + Guard.Against.Null(entity, nameof(entity)); return await _retryPolicy.ExecuteAsync(async () => { diff --git a/src/Database/EntityFramework/Repositories/DicomAssociationInfoRepository.cs b/src/Database/EntityFramework/Repositories/DicomAssociationInfoRepository.cs index 814d5f577..d381e58fc 100644 --- a/src/Database/EntityFramework/Repositories/DicomAssociationInfoRepository.cs +++ b/src/Database/EntityFramework/Repositories/DicomAssociationInfoRepository.cs @@ -42,8 +42,8 @@ public DicomAssociationInfoRepository( ILogger logger, IOptions options) { - Guard.Against.Null(serviceScopeFactory); - Guard.Against.Null(options); + Guard.Against.Null(serviceScopeFactory, nameof(serviceScopeFactory)); + Guard.Against.Null(options, nameof(options)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); @@ -57,7 +57,7 @@ public DicomAssociationInfoRepository( public async Task AddAsync(DicomAssociationInfo item, CancellationToken cancellationToken = default) { - Guard.Against.Null(item); + Guard.Against.Null(item, nameof(item)); return await _retryPolicy.ExecuteAsync(async () => { diff --git a/src/Database/EntityFramework/Repositories/InferenceRequestRepository.cs b/src/Database/EntityFramework/Repositories/InferenceRequestRepository.cs index d3780c8aa..5ca49d64d 100644 --- a/src/Database/EntityFramework/Repositories/InferenceRequestRepository.cs +++ b/src/Database/EntityFramework/Repositories/InferenceRequestRepository.cs @@ -47,7 +47,7 @@ public InferenceRequestRepository( ILogger logger, IOptions options) : base(logger, options) { - Guard.Against.Null(serviceScopeFactory); + Guard.Against.Null(serviceScopeFactory, nameof(serviceScopeFactory)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _options = options ?? throw new ArgumentNullException(nameof(options)); @@ -61,7 +61,7 @@ public InferenceRequestRepository( public override async Task AddAsync(InferenceRequest inferenceRequest, CancellationToken cancellationToken = default) { - Guard.Against.Null(inferenceRequest); + Guard.Against.Null(inferenceRequest, nameof(inferenceRequest)); using var loggerScope = _logger.BeginScope(new LoggingDataDictionary { { "TransactionId", inferenceRequest.TransactionId } }); await _retryPolicy.ExecuteAsync(async () => @@ -103,7 +103,7 @@ public override async Task TakeAsync(CancellationToken cancell public override async Task GetInferenceRequestAsync(string transactionId, CancellationToken cancellationToken = default) { - Guard.Against.NullOrWhiteSpace(transactionId); + Guard.Against.NullOrWhiteSpace(transactionId, nameof(transactionId)); return await _retryPolicy.ExecuteAsync(async () => { @@ -113,7 +113,7 @@ public override async Task TakeAsync(CancellationToken cancell public override async Task GetInferenceRequestAsync(Guid inferenceRequestId, CancellationToken cancellationToken = default) { - Guard.Against.NullOrEmpty(inferenceRequestId); + Guard.Against.NullOrEmpty(inferenceRequestId, nameof(inferenceRequestId)); return await _retryPolicy.ExecuteAsync(async () => { @@ -123,7 +123,7 @@ public override async Task TakeAsync(CancellationToken cancell protected override async Task SaveAsync(InferenceRequest inferenceRequest, CancellationToken cancellationToken = default) { - Guard.Against.Null(inferenceRequest); + Guard.Against.Null(inferenceRequest, nameof(inferenceRequest)); await _retryPolicy.ExecuteAsync(async () => { diff --git a/src/Database/EntityFramework/Repositories/MonaiApplicationEntityRepository.cs b/src/Database/EntityFramework/Repositories/MonaiApplicationEntityRepository.cs index 41148acbc..e84cb78ff 100644 --- a/src/Database/EntityFramework/Repositories/MonaiApplicationEntityRepository.cs +++ b/src/Database/EntityFramework/Repositories/MonaiApplicationEntityRepository.cs @@ -43,8 +43,8 @@ public MonaiApplicationEntityRepository( ILogger logger, IOptions options) { - Guard.Against.Null(serviceScopeFactory); - Guard.Against.Null(options); + Guard.Against.Null(serviceScopeFactory, nameof(serviceScopeFactory)); + Guard.Against.Null(options, nameof(options)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); @@ -58,7 +58,7 @@ public MonaiApplicationEntityRepository( public async Task AddAsync(MonaiApplicationEntity item, CancellationToken cancellationToken = default) { - Guard.Against.Null(item); + Guard.Against.Null(item, nameof(item)); return await _retryPolicy.ExecuteAsync(async () => { @@ -79,7 +79,7 @@ public async Task ContainsAsync(Expression FindByNameAsync(string name, CancellationToken cancellationToken = default) { - Guard.Against.NullOrWhiteSpace(name); + Guard.Against.NullOrWhiteSpace(name, nameof(name)); return await _retryPolicy.ExecuteAsync(async () => { @@ -89,7 +89,7 @@ public async Task ContainsAsync(Expression RemoveAsync(MonaiApplicationEntity entity, CancellationToken cancellationToken = default) { - Guard.Against.Null(entity); + Guard.Against.Null(entity, nameof(entity)); return await _retryPolicy.ExecuteAsync(async () => { @@ -109,7 +109,7 @@ public async Task> ToListAsync(CancellationToken ca public async Task UpdateAsync(MonaiApplicationEntity entity, CancellationToken cancellationToken = default) { - Guard.Against.Null(entity); + Guard.Against.Null(entity, nameof(entity)); return await _retryPolicy.ExecuteAsync(async () => { diff --git a/src/Database/EntityFramework/Repositories/PayloadRepository.cs b/src/Database/EntityFramework/Repositories/PayloadRepository.cs index e70590acc..441fe2544 100644 --- a/src/Database/EntityFramework/Repositories/PayloadRepository.cs +++ b/src/Database/EntityFramework/Repositories/PayloadRepository.cs @@ -42,8 +42,8 @@ public PayloadRepository( ILogger logger, IOptions options) { - Guard.Against.Null(serviceScopeFactory); - Guard.Against.Null(options); + Guard.Against.Null(serviceScopeFactory, nameof(serviceScopeFactory)); + Guard.Against.Null(options, nameof(options)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); @@ -57,7 +57,7 @@ public PayloadRepository( public async Task AddAsync(Payload item, CancellationToken cancellationToken = default) { - Guard.Against.Null(item); + Guard.Against.Null(item, nameof(item)); return await _retryPolicy.ExecuteAsync(async () => { @@ -69,7 +69,7 @@ public async Task AddAsync(Payload item, CancellationToken cancellation public async Task RemoveAsync(Payload entity, CancellationToken cancellationToken = default) { - Guard.Against.Null(entity); + Guard.Against.Null(entity, nameof(entity)); return await _retryPolicy.ExecuteAsync(async () => { @@ -89,7 +89,7 @@ public async Task> ToListAsync(CancellationToken cancellationToken public async Task UpdateAsync(Payload entity, CancellationToken cancellationToken = default) { - Guard.Against.Null(entity); + Guard.Against.Null(entity, nameof(entity)); return await _retryPolicy.ExecuteAsync(async () => { diff --git a/src/Database/EntityFramework/Repositories/SourceApplicationEntityRepository.cs b/src/Database/EntityFramework/Repositories/SourceApplicationEntityRepository.cs index 9df43c899..d4abf081b 100644 --- a/src/Database/EntityFramework/Repositories/SourceApplicationEntityRepository.cs +++ b/src/Database/EntityFramework/Repositories/SourceApplicationEntityRepository.cs @@ -43,8 +43,8 @@ public SourceApplicationEntityRepository( ILogger logger, IOptions options) { - Guard.Against.Null(serviceScopeFactory); - Guard.Against.Null(options); + Guard.Against.Null(serviceScopeFactory, nameof(serviceScopeFactory)); + Guard.Against.Null(options, nameof(options)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); @@ -58,7 +58,7 @@ public SourceApplicationEntityRepository( public async Task AddAsync(SourceApplicationEntity item, CancellationToken cancellationToken = default) { - Guard.Against.Null(item); + Guard.Against.Null(item, nameof(item)); return await _retryPolicy.ExecuteAsync(async () => { @@ -79,7 +79,7 @@ public async Task ContainsAsync(Expression FindByNameAsync(string name, CancellationToken cancellationToken = default) { - Guard.Against.NullOrWhiteSpace(name); + Guard.Against.NullOrWhiteSpace(name, nameof(name)); return await _retryPolicy.ExecuteAsync(async () => { @@ -89,7 +89,7 @@ public async Task ContainsAsync(Expression FindByAETAsync(string aeTitle, CancellationToken cancellationToken = default) { - Guard.Against.NullOrWhiteSpace(aeTitle); + Guard.Against.NullOrWhiteSpace(aeTitle, nameof(aeTitle)); return await _retryPolicy.ExecuteAsync(async () => { @@ -99,7 +99,7 @@ public async Task ContainsAsync(Expression RemoveAsync(SourceApplicationEntity entity, CancellationToken cancellationToken = default) { - Guard.Against.Null(entity); + Guard.Against.Null(entity, nameof(entity)); return await _retryPolicy.ExecuteAsync(async () => { @@ -119,7 +119,7 @@ public async Task> ToListAsync(CancellationToken c public async Task UpdateAsync(SourceApplicationEntity entity, CancellationToken cancellationToken = default) { - Guard.Against.Null(entity); + Guard.Against.Null(entity, nameof(entity)); return await _retryPolicy.ExecuteAsync(async () => { diff --git a/src/Database/EntityFramework/Repositories/StorageMetadataWrapperRepository.cs b/src/Database/EntityFramework/Repositories/StorageMetadataWrapperRepository.cs index adb69a347..201730eca 100644 --- a/src/Database/EntityFramework/Repositories/StorageMetadataWrapperRepository.cs +++ b/src/Database/EntityFramework/Repositories/StorageMetadataWrapperRepository.cs @@ -45,8 +45,8 @@ public StorageMetadataWrapperRepository( ILogger logger, IOptions options) : base(logger) { - Guard.Against.Null(serviceScopeFactory); - Guard.Against.Null(options); + Guard.Against.Null(serviceScopeFactory, nameof(serviceScopeFactory)); + Guard.Against.Null(options, nameof(options)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); @@ -60,7 +60,7 @@ public StorageMetadataWrapperRepository( protected override async Task AddAsyncInternal(StorageMetadataWrapper metadata, CancellationToken cancellationToken = default) { - Guard.Against.Null(metadata); + Guard.Against.Null(metadata, nameof(metadata)); await _retryPolicy.ExecuteAsync(async () => { @@ -73,7 +73,7 @@ await _retryPolicy.ExecuteAsync(async () => protected override async Task UpdateInternal(StorageMetadataWrapper metadata, CancellationToken cancellationToken = default) { - Guard.Against.Null(metadata); + Guard.Against.Null(metadata, nameof(metadata)); await _retryPolicy.ExecuteAsync(async () => { @@ -95,7 +95,7 @@ await _retryPolicy.ExecuteAsync(async () => public override async Task> GetFileStorageMetdadataAsync(string correlationId, CancellationToken cancellationToken = default) { - Guard.Against.NullOrWhiteSpace(correlationId); + Guard.Against.NullOrWhiteSpace(correlationId, nameof(correlationId)); return await _retryPolicy.ExecuteAsync(async () => { @@ -108,8 +108,8 @@ public override async Task> GetFileStorageMetdadataAs public override async Task GetFileStorageMetdadataAsync(string correlationId, string identity, CancellationToken cancellationToken = default) { - Guard.Against.NullOrWhiteSpace(correlationId); - Guard.Against.NullOrWhiteSpace(identity); + Guard.Against.NullOrWhiteSpace(correlationId, nameof(correlationId)); + Guard.Against.NullOrWhiteSpace(identity, nameof(identity)); return await _retryPolicy.ExecuteAsync(async () => { @@ -122,7 +122,7 @@ public override async Task> GetFileStorageMetdadataAs protected override async Task DeleteInternalAsync(StorageMetadataWrapper metadata, CancellationToken cancellationToken = default) { - Guard.Against.Null(metadata); + Guard.Against.Null(metadata, nameof(metadata)); return await _retryPolicy.ExecuteAsync(async () => { diff --git a/src/Database/EntityFramework/Test/packages.lock.json b/src/Database/EntityFramework/Test/packages.lock.json index f3cacb2ec..8f36d009e 100644 --- a/src/Database/EntityFramework/Test/packages.lock.json +++ b/src/Database/EntityFramework/Test/packages.lock.json @@ -55,11 +55,8 @@ }, "Ardalis.GuardClauses": { "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "AWSSDK.Core": { "type": "Transitive", @@ -98,11 +95,6 @@ "System.Threading.Channels": "6.0.0" } }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Macross.Json.Extensions": { "type": "Transitive", "resolved": "3.0.0", @@ -1471,7 +1463,7 @@ "monai.deploy.informaticsgateway.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.IO.Abstractions": "[17.2.3, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )", "fo-dicom": "[5.0.3, )" diff --git a/src/Database/EntityFramework/packages.lock.json b/src/Database/EntityFramework/packages.lock.json index 83b19f909..8166997db 100644 --- a/src/Database/EntityFramework/packages.lock.json +++ b/src/Database/EntityFramework/packages.lock.json @@ -75,11 +75,8 @@ }, "Ardalis.GuardClauses": { "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "AWSSDK.Core": { "type": "Transitive", @@ -115,11 +112,6 @@ "resolved": "2.8.26", "contentHash": "OiKusGL20vby4uDEswj2IgkdchC1yQ6rwbIkZDVBPIR6al2b7n3pC91elBul9q33KaBgRKhbZH3+2Ur4fnWx2A==" }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Macross.Json.Extensions": { "type": "Transitive", "resolved": "3.0.0", @@ -480,7 +472,7 @@ "monai.deploy.informaticsgateway.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.IO.Abstractions": "[17.2.3, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )", "fo-dicom": "[5.0.3, )" diff --git a/src/Database/MongoDB/Integration.Test/packages.lock.json b/src/Database/MongoDB/Integration.Test/packages.lock.json index 6232d5932..b679a4943 100644 --- a/src/Database/MongoDB/Integration.Test/packages.lock.json +++ b/src/Database/MongoDB/Integration.Test/packages.lock.json @@ -55,11 +55,8 @@ }, "Ardalis.GuardClauses": { "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "AWSSDK.Core": { "type": "Transitive", @@ -106,11 +103,6 @@ "System.Threading.Channels": "6.0.0" } }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Macross.Json.Extensions": { "type": "Transitive", "resolved": "3.0.0", @@ -1441,7 +1433,7 @@ "monai.deploy.informaticsgateway.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.IO.Abstractions": "[17.2.3, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )", "fo-dicom": "[5.0.3, )" diff --git a/src/Database/MongoDB/Repositories/DestinationApplicationEntityRepository.cs b/src/Database/MongoDB/Repositories/DestinationApplicationEntityRepository.cs index 0807986b6..4e10ef186 100644 --- a/src/Database/MongoDB/Repositories/DestinationApplicationEntityRepository.cs +++ b/src/Database/MongoDB/Repositories/DestinationApplicationEntityRepository.cs @@ -45,9 +45,9 @@ public DestinationApplicationEntityRepository( IOptions options, IOptions mongoDbOptions) { - Guard.Against.Null(serviceScopeFactory); - Guard.Against.Null(options); - Guard.Against.Null(mongoDbOptions); + Guard.Against.Null(serviceScopeFactory, nameof(serviceScopeFactory)); + Guard.Against.Null(options, nameof(options)); + Guard.Against.Null(mongoDbOptions, nameof(mongoDbOptions)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); @@ -88,7 +88,7 @@ public async Task> ToListAsync(CancellationTo public async Task FindByNameAsync(string name, CancellationToken cancellationToken = default) { - Guard.Against.NullOrWhiteSpace(name); + Guard.Against.NullOrWhiteSpace(name, nameof(name)); return await _retryPolicy.ExecuteAsync(async () => { @@ -100,7 +100,7 @@ public async Task> ToListAsync(CancellationTo public async Task AddAsync(DestinationApplicationEntity item, CancellationToken cancellationToken = default) { - Guard.Against.Null(item); + Guard.Against.Null(item, nameof(item)); return await _retryPolicy.ExecuteAsync(async () => { @@ -111,7 +111,7 @@ public async Task AddAsync(DestinationApplicationE public async Task UpdateAsync(DestinationApplicationEntity entity, CancellationToken cancellationToken = default) { - Guard.Against.Null(entity); + Guard.Against.Null(entity, nameof(entity)); return await _retryPolicy.ExecuteAsync(async () => { @@ -126,7 +126,7 @@ public async Task UpdateAsync(DestinationApplicati public async Task RemoveAsync(DestinationApplicationEntity entity, CancellationToken cancellationToken = default) { - Guard.Against.Null(entity); + Guard.Against.Null(entity, nameof(entity)); return await _retryPolicy.ExecuteAsync(async () => { diff --git a/src/Database/MongoDB/Repositories/DicomAssociationInfoRepository.cs b/src/Database/MongoDB/Repositories/DicomAssociationInfoRepository.cs index 3ce0b7061..350bf1d47 100644 --- a/src/Database/MongoDB/Repositories/DicomAssociationInfoRepository.cs +++ b/src/Database/MongoDB/Repositories/DicomAssociationInfoRepository.cs @@ -43,9 +43,9 @@ public DicomAssociationInfoRepository( IOptions options, IOptions mongoDbOptions) { - Guard.Against.Null(serviceScopeFactory); - Guard.Against.Null(options); - Guard.Against.Null(mongoDbOptions); + Guard.Against.Null(serviceScopeFactory, nameof(serviceScopeFactory)); + Guard.Against.Null(options, nameof(options)); + Guard.Against.Null(mongoDbOptions, nameof(mongoDbOptions)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); @@ -61,7 +61,7 @@ public DicomAssociationInfoRepository( public async Task AddAsync(DicomAssociationInfo item, CancellationToken cancellationToken = default) { - Guard.Against.Null(item); + Guard.Against.Null(item, nameof(item)); return await _retryPolicy.ExecuteAsync(async () => { diff --git a/src/Database/MongoDB/Repositories/InferenceRequestRepository.cs b/src/Database/MongoDB/Repositories/InferenceRequestRepository.cs index d064eb93b..1686ec48d 100644 --- a/src/Database/MongoDB/Repositories/InferenceRequestRepository.cs +++ b/src/Database/MongoDB/Repositories/InferenceRequestRepository.cs @@ -49,7 +49,7 @@ public InferenceRequestRepository( IOptions options, IOptions mongoDbOptions) : base(logger, options) { - Guard.Against.Null(serviceScopeFactory); + Guard.Against.Null(serviceScopeFactory, nameof(serviceScopeFactory)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _options = options ?? throw new ArgumentNullException(nameof(options)); @@ -79,7 +79,7 @@ private void CreateIndexes() public override async Task AddAsync(InferenceRequest inferenceRequest, CancellationToken cancellationToken = default) { - Guard.Against.Null(inferenceRequest); + Guard.Against.Null(inferenceRequest, nameof(inferenceRequest)); using var loggerScope = _logger.BeginScope(new LoggingDataDictionary { { "TransactionId", inferenceRequest.TransactionId } }); await _retryPolicy.ExecuteAsync(async () => @@ -123,7 +123,7 @@ public override async Task TakeAsync(CancellationToken cancell public override async Task GetInferenceRequestAsync(string transactionId, CancellationToken cancellationToken = default) { - Guard.Against.NullOrWhiteSpace(transactionId); + Guard.Against.NullOrWhiteSpace(transactionId, nameof(transactionId)); return await _retryPolicy.ExecuteAsync(async () => { @@ -135,7 +135,7 @@ public override async Task TakeAsync(CancellationToken cancell public override async Task GetInferenceRequestAsync(Guid inferenceRequestId, CancellationToken cancellationToken = default) { - Guard.Against.NullOrEmpty(inferenceRequestId); + Guard.Against.NullOrEmpty(inferenceRequestId, nameof(inferenceRequestId)); return await _retryPolicy.ExecuteAsync(async () => { @@ -147,7 +147,7 @@ public override async Task TakeAsync(CancellationToken cancell protected override async Task SaveAsync(InferenceRequest inferenceRequest, CancellationToken cancellationToken = default) { - Guard.Against.Null(inferenceRequest); + Guard.Against.Null(inferenceRequest, nameof(inferenceRequest)); await _retryPolicy.ExecuteAsync(async () => { diff --git a/src/Database/MongoDB/Repositories/MonaiApplicationEntityRepository.cs b/src/Database/MongoDB/Repositories/MonaiApplicationEntityRepository.cs index f160457a1..c4e67cb20 100644 --- a/src/Database/MongoDB/Repositories/MonaiApplicationEntityRepository.cs +++ b/src/Database/MongoDB/Repositories/MonaiApplicationEntityRepository.cs @@ -45,9 +45,9 @@ public MonaiApplicationEntityRepository( IOptions options, IOptions mongoDbOptions) { - Guard.Against.Null(serviceScopeFactory); - Guard.Against.Null(options); - Guard.Against.Null(mongoDbOptions); + Guard.Against.Null(serviceScopeFactory, nameof(serviceScopeFactory)); + Guard.Against.Null(options, nameof(options)); + Guard.Against.Null(mongoDbOptions, nameof(mongoDbOptions)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); @@ -81,7 +81,7 @@ public async Task> ToListAsync(CancellationToken ca public async Task FindByNameAsync(string name, CancellationToken cancellationToken = default) { - Guard.Against.NullOrWhiteSpace(name); + Guard.Against.NullOrWhiteSpace(name, nameof(name)); return await _retryPolicy.ExecuteAsync(async () => { @@ -93,7 +93,7 @@ public async Task> ToListAsync(CancellationToken ca public async Task AddAsync(MonaiApplicationEntity item, CancellationToken cancellationToken = default) { - Guard.Against.Null(item); + Guard.Against.Null(item, nameof(item)); return await _retryPolicy.ExecuteAsync(async () => { @@ -104,7 +104,7 @@ public async Task AddAsync(MonaiApplicationEntity item, public async Task UpdateAsync(MonaiApplicationEntity entity, CancellationToken cancellationToken = default) { - Guard.Against.Null(entity); + Guard.Against.Null(entity, nameof(entity)); return await _retryPolicy.ExecuteAsync(async () => { @@ -119,7 +119,7 @@ public async Task UpdateAsync(MonaiApplicationEntity ent public async Task RemoveAsync(MonaiApplicationEntity entity, CancellationToken cancellationToken = default) { - Guard.Against.Null(entity); + Guard.Against.Null(entity, nameof(entity)); return await _retryPolicy.ExecuteAsync(async () => { diff --git a/src/Database/MongoDB/Repositories/PayloadRepository.cs b/src/Database/MongoDB/Repositories/PayloadRepository.cs index 6a3f50dbf..f48714e8a 100644 --- a/src/Database/MongoDB/Repositories/PayloadRepository.cs +++ b/src/Database/MongoDB/Repositories/PayloadRepository.cs @@ -45,9 +45,9 @@ public PayloadRepository( IOptions options, IOptions mongoDbOptions) { - Guard.Against.Null(serviceScopeFactory); - Guard.Against.Null(options); - Guard.Against.Null(mongoDbOptions); + Guard.Against.Null(serviceScopeFactory, nameof(serviceScopeFactory)); + Guard.Against.Null(options, nameof(options)); + Guard.Against.Null(mongoDbOptions, nameof(mongoDbOptions)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); @@ -73,7 +73,7 @@ private void CreateIndexes() public async Task AddAsync(Payload item, CancellationToken cancellationToken = default) { - Guard.Against.Null(item); + Guard.Against.Null(item, nameof(item)); return await _retryPolicy.ExecuteAsync(async () => { @@ -84,7 +84,7 @@ public async Task AddAsync(Payload item, CancellationToken cancellation public async Task RemoveAsync(Payload entity, CancellationToken cancellationToken = default) { - Guard.Against.Null(entity); + Guard.Against.Null(entity, nameof(entity)); return await _retryPolicy.ExecuteAsync(async () => { @@ -107,7 +107,7 @@ public async Task> ToListAsync(CancellationToken cancellationToken public async Task UpdateAsync(Payload entity, CancellationToken cancellationToken = default) { - Guard.Against.Null(entity); + Guard.Against.Null(entity, nameof(entity)); return await _retryPolicy.ExecuteAsync(async () => { diff --git a/src/Database/MongoDB/Repositories/SourceApplicationEntityRepository.cs b/src/Database/MongoDB/Repositories/SourceApplicationEntityRepository.cs index 11cedd1db..997378042 100644 --- a/src/Database/MongoDB/Repositories/SourceApplicationEntityRepository.cs +++ b/src/Database/MongoDB/Repositories/SourceApplicationEntityRepository.cs @@ -45,9 +45,9 @@ public SourceApplicationEntityRepository( IOptions options, IOptions mongoDbOptions) { - Guard.Against.Null(serviceScopeFactory); - Guard.Against.Null(options); - Guard.Against.Null(mongoDbOptions); + Guard.Against.Null(serviceScopeFactory, nameof(serviceScopeFactory)); + Guard.Against.Null(options, nameof(options)); + Guard.Against.Null(mongoDbOptions, nameof(mongoDbOptions)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); @@ -87,7 +87,7 @@ public async Task> ToListAsync(CancellationToken c public async Task FindByNameAsync(string name, CancellationToken cancellationToken = default) { - Guard.Against.NullOrWhiteSpace(name); + Guard.Against.NullOrWhiteSpace(name, nameof(name)); return await _retryPolicy.ExecuteAsync(async () => { @@ -109,7 +109,7 @@ public async Task> ToListAsync(CancellationToken c public async Task AddAsync(SourceApplicationEntity item, CancellationToken cancellationToken = default) { - Guard.Against.Null(item); + Guard.Against.Null(item, nameof(item)); return await _retryPolicy.ExecuteAsync(async () => { @@ -120,7 +120,7 @@ public async Task AddAsync(SourceApplicationEntity item public async Task UpdateAsync(SourceApplicationEntity entity, CancellationToken cancellationToken = default) { - Guard.Against.Null(entity); + Guard.Against.Null(entity, nameof(entity)); return await _retryPolicy.ExecuteAsync(async () => { @@ -135,7 +135,7 @@ public async Task UpdateAsync(SourceApplicationEntity e public async Task RemoveAsync(SourceApplicationEntity entity, CancellationToken cancellationToken = default) { - Guard.Against.Null(entity); + Guard.Against.Null(entity, nameof(entity)); return await _retryPolicy.ExecuteAsync(async () => { diff --git a/src/Database/MongoDB/Repositories/StorageMetadataWrapperRepository.cs b/src/Database/MongoDB/Repositories/StorageMetadataWrapperRepository.cs index 25d51a47f..da1a97a66 100644 --- a/src/Database/MongoDB/Repositories/StorageMetadataWrapperRepository.cs +++ b/src/Database/MongoDB/Repositories/StorageMetadataWrapperRepository.cs @@ -47,9 +47,9 @@ public StorageMetadataWrapperRepository( IOptions options, IOptions mongoDbOptions) : base(logger) { - Guard.Against.Null(serviceScopeFactory); - Guard.Against.Null(options); - Guard.Against.Null(mongoDbOptions); + Guard.Against.Null(serviceScopeFactory, nameof(serviceScopeFactory)); + Guard.Against.Null(options, nameof(options)); + Guard.Against.Null(mongoDbOptions, nameof(mongoDbOptions)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); @@ -75,7 +75,7 @@ private void CreateIndexes() protected override async Task DeleteInternalAsync(StorageMetadataWrapper toBeDeleted, CancellationToken cancellationToken) { - Guard.Against.Null(toBeDeleted); + Guard.Against.Null(toBeDeleted, nameof(toBeDeleted)); return await _retryPolicy.ExecuteAsync(async () => { @@ -94,7 +94,7 @@ await _retryPolicy.ExecuteAsync(async () => public override async Task> GetFileStorageMetdadataAsync(string correlationId, CancellationToken cancellationToken = default) { - Guard.Against.NullOrWhiteSpace(correlationId); + Guard.Against.NullOrWhiteSpace(correlationId, nameof(correlationId)); return await _retryPolicy.ExecuteAsync(async () => { @@ -107,7 +107,7 @@ public override async Task> GetFileStorageMetdadataAs public override async Task GetFileStorageMetdadataAsync(string correlationId, string identity, CancellationToken cancellationToken = default) { - Guard.Against.NullOrWhiteSpace(correlationId); + Guard.Against.NullOrWhiteSpace(correlationId, nameof(correlationId)); return await _retryPolicy.ExecuteAsync(async () => { @@ -120,7 +120,7 @@ public override async Task> GetFileStorageMetdadataAs protected override async Task UpdateInternal(StorageMetadataWrapper metadata, CancellationToken cancellationToken = default) { - Guard.Against.Null(metadata); + Guard.Against.Null(metadata, nameof(metadata)); await _retryPolicy.ExecuteAsync(async () => { @@ -145,7 +145,7 @@ await _collection.ReplaceOneAsync( protected override async Task AddAsyncInternal(StorageMetadataWrapper metadata, CancellationToken cancellationToken = default) { - Guard.Against.Null(metadata); + Guard.Against.Null(metadata, nameof(metadata)); await _retryPolicy.ExecuteAsync(async () => { diff --git a/src/Database/MongoDB/packages.lock.json b/src/Database/MongoDB/packages.lock.json index 4971a9653..963544838 100644 --- a/src/Database/MongoDB/packages.lock.json +++ b/src/Database/MongoDB/packages.lock.json @@ -33,11 +33,8 @@ }, "Ardalis.GuardClauses": { "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "AWSSDK.Core": { "type": "Transitive", @@ -76,11 +73,6 @@ "System.Threading.Channels": "6.0.0" } }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Macross.Json.Extensions": { "type": "Transitive", "resolved": "3.0.0", @@ -419,7 +411,7 @@ "monai.deploy.informaticsgateway.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.IO.Abstractions": "[17.2.3, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )", "fo-dicom": "[5.0.3, )" diff --git a/src/Database/packages.lock.json b/src/Database/packages.lock.json index ceeec7977..2f08cf466 100644 --- a/src/Database/packages.lock.json +++ b/src/Database/packages.lock.json @@ -89,11 +89,8 @@ }, "Ardalis.GuardClauses": { "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "AWSSDK.Core": { "type": "Transitive", @@ -132,11 +129,6 @@ "System.Threading.Channels": "6.0.0" } }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Macross.Json.Extensions": { "type": "Transitive", "resolved": "3.0.0", @@ -592,7 +584,7 @@ "monai.deploy.informaticsgateway.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.IO.Abstractions": "[17.2.3, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )", "fo-dicom": "[5.0.3, )" diff --git a/src/DicomWebClient/CLI/Qido.cs b/src/DicomWebClient/CLI/Qido.cs index f02b6a461..2748e39a6 100644 --- a/src/DicomWebClient/CLI/Qido.cs +++ b/src/DicomWebClient/CLI/Qido.cs @@ -87,8 +87,8 @@ private Dictionary ParseQueryString(string query) private async Task SaveJson(string outputDir, IAsyncEnumerable enumerable) { - Guard.Against.NullOrWhiteSpace(outputDir); - Guard.Against.Null(enumerable); + Guard.Against.NullOrWhiteSpace(outputDir, nameof(outputDir)); + Guard.Against.Null(enumerable, nameof(enumerable)); await foreach (var item in enumerable) { @@ -98,7 +98,7 @@ private async Task SaveJson(string outputDir, IAsyncEnumerable enumerabl private void ValidateOutputDirectory(ref string outputDir) { - Guard.Against.NullOrWhiteSpace(outputDir); + Guard.Against.NullOrWhiteSpace(outputDir, nameof(outputDir)); if (outputDir == ".") { @@ -112,7 +112,7 @@ private void ValidateOutputDirectory(ref string outputDir) private void ValidateOptions(string rootUrl, out Uri rootUri) { - Guard.Against.NullOrWhiteSpace(rootUrl); + Guard.Against.NullOrWhiteSpace(rootUrl, nameof(rootUri)); _logger.LogInformation("Checking arguments..."); rootUri = new Uri(rootUrl); diff --git a/src/DicomWebClient/CLI/Stow.cs b/src/DicomWebClient/CLI/Stow.cs index fa673121b..460b5d9e7 100644 --- a/src/DicomWebClient/CLI/Stow.cs +++ b/src/DicomWebClient/CLI/Stow.cs @@ -132,7 +132,7 @@ private void AddValidFiles(List dicomFiles, params string[] files) private void ValidateOptions(string rootUrl, out Uri rootUri) { - Guard.Against.NullOrWhiteSpace(rootUrl); + Guard.Against.NullOrWhiteSpace(rootUrl, nameof(rootUrl)); _logger.LogInformation("Checking arguments..."); rootUri = new Uri(rootUrl); diff --git a/src/DicomWebClient/CLI/Utils.cs b/src/DicomWebClient/CLI/Utils.cs index 583903e30..a44315fa3 100644 --- a/src/DicomWebClient/CLI/Utils.cs +++ b/src/DicomWebClient/CLI/Utils.cs @@ -31,8 +31,8 @@ internal static class Utils { public static void CheckAndConfirmOverwriteOutputFilename(ILogger logger, string filename) { - Guard.Against.Null(logger); - Guard.Against.NullOrWhiteSpace(filename); + Guard.Against.Null(logger, nameof(logger)); + Guard.Against.NullOrWhiteSpace(filename, nameof(filename)); if (File.Exists(filename)) { @@ -52,8 +52,8 @@ public static void CheckAndConfirmOverwriteOutputFilename(ILogger logger, public static void CheckAndConfirmOverwriteOutput(ILogger logger, string outputDir) { - Guard.Against.Null(logger); - Guard.Against.NullOrWhiteSpace(outputDir); + Guard.Against.Null(logger, nameof(logger)); + Guard.Against.NullOrWhiteSpace(outputDir, nameof(outputDir)); if (Directory.Exists(outputDir)) { @@ -78,8 +78,8 @@ public static void CheckAndConfirmOverwriteOutput(ILogger logger, string o public static AuthenticationHeaderValue GenerateFromUsernamePassword(string username, string password) { - Guard.Against.NullOrWhiteSpace(username); - Guard.Against.NullOrWhiteSpace(password); + Guard.Against.NullOrWhiteSpace(username, nameof(username)); + Guard.Against.NullOrWhiteSpace(username, nameof(username)); var authToken = Encoding.ASCII.GetBytes($"{username}:{password}"); return new AuthenticationHeaderValue("Basic", Convert.ToBase64String(authToken)); @@ -93,9 +93,9 @@ public static async Task SaveFiles(ILogger logger, string outputDirectory, public static async Task SaveFiles(ILogger logger, DicomFile dicomFile, string filename) { - Guard.Against.Null(logger); - Guard.Against.Null(dicomFile); - Guard.Against.NullOrWhiteSpace(filename); + Guard.Against.Null(logger, nameof(logger)); + Guard.Against.Null(dicomFile, nameof(dicomFile)); + Guard.Against.NullOrWhiteSpace(filename, nameof(filename)); logger.LogInformation($"Saving {filename}..."); await dicomFile.SaveAsync(filename).ConfigureAwait(false); @@ -103,9 +103,9 @@ public static async Task SaveFiles(ILogger logger, DicomFile dicomFile, st internal static async Task SaveJson(ILogger logger, string outputDir, string item, DicomTag filenameSourceTag) { - Guard.Against.Null(logger); - Guard.Against.NullOrWhiteSpace(outputDir); - Guard.Against.NullOrWhiteSpace(item); + Guard.Against.Null(logger, nameof(logger)); + Guard.Against.NullOrWhiteSpace(outputDir, nameof(outputDir)); + Guard.Against.NullOrWhiteSpace(item, nameof(item)); var token = JToken.Parse(item); var value = GetTagValueFromJson(token, filenameSourceTag); @@ -125,9 +125,9 @@ internal static async Task SaveJson(ILogger logger, string outputDir, string ite internal static async Task SaveJson(ILogger logger, string outputFilename, string text) { - Guard.Against.Null(logger); - Guard.Against.NullOrWhiteSpace(outputFilename); - Guard.Against.NullOrWhiteSpace(text); + Guard.Against.Null(logger, nameof(logger)); + Guard.Against.NullOrWhiteSpace(outputFilename, nameof(outputFilename)); + Guard.Against.NullOrWhiteSpace(text, nameof(text)); var token = JToken.Parse(text); logger.LogInformation($"Saving JSON {outputFilename}..."); @@ -136,8 +136,8 @@ internal static async Task SaveJson(ILogger logger, string outputFilename, strin private static string GetTagValueFromJson(JToken token, DicomTag dicomTag, string defaultValue = "unknown") { - Guard.Against.Null(token); - Guard.Against.Null(dicomTag); + Guard.Against.Null(token, nameof(token)); + Guard.Against.Null(dicomTag, nameof(dicomTag)); var tag = $"{dicomTag.Group:X4}{dicomTag.Element:X4}"; diff --git a/src/DicomWebClient/CLI/Wado.cs b/src/DicomWebClient/CLI/Wado.cs index c2e343d99..fa209dde2 100644 --- a/src/DicomWebClient/CLI/Wado.cs +++ b/src/DicomWebClient/CLI/Wado.cs @@ -176,8 +176,8 @@ public async Task Bulk( private async Task SaveJson(string outputDir, IAsyncEnumerable enumerable) { - Guard.Against.NullOrWhiteSpace(outputDir); - Guard.Against.Null(enumerable); + Guard.Against.NullOrWhiteSpace(outputDir, nameof(outputDir)); + Guard.Against.Null(enumerable, nameof(enumerable)); await foreach (var item in enumerable) { @@ -187,8 +187,8 @@ private async Task SaveJson(string outputDir, IAsyncEnumerable enumerabl private async Task SaveFiles(string outputDir, IAsyncEnumerable enumerable) { - Guard.Against.NullOrWhiteSpace(outputDir); - Guard.Against.Null(enumerable); + Guard.Against.NullOrWhiteSpace(outputDir, nameof(outputDir)); + Guard.Against.Null(enumerable, nameof(enumerable)); var count = 0; await foreach (var file in enumerable) @@ -201,7 +201,7 @@ private async Task SaveFiles(string outputDir, IAsyncEnumerable enume private void ValidateOutputFilename(ref string filename) { - Guard.Against.NullOrWhiteSpace(filename); + Guard.Against.NullOrWhiteSpace(filename, nameof(filename)); try { @@ -216,7 +216,7 @@ private void ValidateOutputFilename(ref string filename) private void ValidateOutputDirectory(ref string outputDir) { - Guard.Against.NullOrWhiteSpace(outputDir); + Guard.Against.NullOrWhiteSpace(outputDir, nameof(outputDir)); if (outputDir == ".") { @@ -230,8 +230,8 @@ private void ValidateOutputDirectory(ref string outputDir) private void ValidateOptions(string rootUrl, string transferSyntaxes, out Uri rootUri, out List dicomTransferSyntaxes) { - Guard.Against.NullOrWhiteSpace(rootUrl); - Guard.Against.NullOrWhiteSpace(transferSyntaxes); + Guard.Against.NullOrWhiteSpace(rootUrl, nameof(rootUrl)); + Guard.Against.NullOrWhiteSpace(transferSyntaxes, nameof(transferSyntaxes)); _logger.LogInformation("Checking arguments..."); rootUri = new Uri(rootUrl); diff --git a/src/DicomWebClient/CLI/packages.lock.json b/src/DicomWebClient/CLI/packages.lock.json index dcd37d8e5..5b14d53fc 100644 --- a/src/DicomWebClient/CLI/packages.lock.json +++ b/src/DicomWebClient/CLI/packages.lock.json @@ -43,16 +43,8 @@ }, "Ardalis.GuardClauses": { "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } - }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "Microsoft.AspNet.WebApi.Client": { "type": "Transitive", @@ -1474,14 +1466,14 @@ "monai.deploy.informaticsgateway.client.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.Text.Json": "[6.0.7, )" } }, "monai.deploy.informaticsgateway.dicomweb.client": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "Microsoft.AspNet.WebApi.Client": "[5.2.9, )", "Microsoft.Extensions.Http": "[6.0.0, )", "Microsoft.Net.Http.Headers": "[2.2.8, )", diff --git a/src/DicomWebClient/Common/HttpResponseMessageExtension.cs b/src/DicomWebClient/Common/HttpResponseMessageExtension.cs index 016f2a5ec..a4e729527 100644 --- a/src/DicomWebClient/Common/HttpResponseMessageExtension.cs +++ b/src/DicomWebClient/Common/HttpResponseMessageExtension.cs @@ -31,7 +31,7 @@ internal static class HttpMessageExtension { public static void AddRange(this HttpRequestMessage request, Tuple byteRange = null) { - Guard.Against.Null(request); + Guard.Against.Null(request, nameof(request)); if (byteRange is null) { request.Headers.Add(HeaderNames.Range, "byte=0-"); @@ -45,7 +45,7 @@ public static void AddRange(this HttpRequestMessage request, Tuple by public static async IAsyncEnumerable ToDicomAsyncEnumerable(this HttpResponseMessage response) { - Guard.Against.Null(response); + Guard.Against.Null(response, nameof(response)); Guard.Against.Null(response.Content, nameof(response.Content)); await foreach (var buffer in DecodeMultipartMessage(response)) { @@ -58,7 +58,7 @@ public static async IAsyncEnumerable ToDicomAsyncEnumerable(this Http public static async Task ToBinaryData(this HttpResponseMessage response) { - Guard.Against.Null(response); + Guard.Against.Null(response, nameof(response)); using (var memoryStream = new MemoryStream()) { await foreach (var buffer in DecodeMultipartMessage(response)) @@ -71,7 +71,7 @@ public static async Task ToBinaryData(this HttpResponseMessage response) private static async IAsyncEnumerable DecodeMultipartMessage(HttpResponseMessage response) { - Guard.Against.Null(response); + Guard.Against.Null(response, nameof(response)); var contentType = response.Content.Headers.ContentType; if (contentType.MediaType != MimeMappings.MultiPartRelated) { diff --git a/src/DicomWebClient/DicomWebClient.cs b/src/DicomWebClient/DicomWebClient.cs index ddb89a968..d86ccfd22 100644 --- a/src/DicomWebClient/DicomWebClient.cs +++ b/src/DicomWebClient/DicomWebClient.cs @@ -49,7 +49,7 @@ public class DicomWebClient : IDicomWebClient /// Optional logger for capturing client logs. public DicomWebClient(HttpClient httpClient, ILogger logger) { - Guard.Against.Null(httpClient); + Guard.Against.Null(httpClient, nameof(httpClient)); _httpClient = httpClient; _logger = logger; @@ -83,7 +83,7 @@ public void ConfigureServiceUris(Uri uriRoot) public void ConfigureServicePrefix(DicomWebServiceType serviceType, string urlPrefix) #pragma warning restore CA1054 { - Guard.Against.NullOrWhiteSpace(urlPrefix); + Guard.Against.NullOrWhiteSpace(urlPrefix, nameof(urlPrefix)); switch (serviceType) { @@ -113,7 +113,7 @@ public void ConfigureServicePrefix(DicomWebServiceType serviceType, string urlPr /// public void ConfigureAuthentication(AuthenticationHeaderValue value) { - Guard.Against.Null(value); + Guard.Against.Null(value, nameof(value)); _httpClient.DefaultRequestHeaders.Authorization = value; } diff --git a/src/DicomWebClient/Monai.Deploy.InformaticsGateway.DicomWeb.Client.csproj b/src/DicomWebClient/Monai.Deploy.InformaticsGateway.DicomWeb.Client.csproj index 8aeb062df..667b67112 100644 --- a/src/DicomWebClient/Monai.Deploy.InformaticsGateway.DicomWeb.Client.csproj +++ b/src/DicomWebClient/Monai.Deploy.InformaticsGateway.DicomWeb.Client.csproj @@ -48,7 +48,7 @@ - + diff --git a/src/DicomWebClient/Services/QidoService.cs b/src/DicomWebClient/Services/QidoService.cs index 8d2e3dc98..73d3c248c 100644 --- a/src/DicomWebClient/Services/QidoService.cs +++ b/src/DicomWebClient/Services/QidoService.cs @@ -71,7 +71,7 @@ public async IAsyncEnumerable SearchForStudies(IReadOnlyDictionary queries, bool fuzzyMatching, int limit, int offset) { - Guard.Against.Null(queries); + Guard.Against.Null(queries, nameof(queries)); if (fuzzyMatching) { queries.Add("fuzzymatching=true"); @@ -90,7 +90,7 @@ private void AppendQueryOptions(List queries, bool fuzzyMatching, int li private void AppendAdditionalFields(List queries, IReadOnlyList fieldsToInclude) { - Guard.Against.Null(queries); + Guard.Against.Null(queries, nameof(queries)); if (fieldsToInclude is null || fieldsToInclude.Count == 0) { @@ -105,7 +105,7 @@ private void AppendAdditionalFields(List queries, IReadOnlyList private void AppendQueryParameters(List queries, IReadOnlyDictionary queryParameters) { - Guard.Against.Null(queries); + Guard.Against.Null(queries, nameof(queries)); if (queryParameters is null || queryParameters.Count == 0) { diff --git a/src/DicomWebClient/Services/ServiceBase.cs b/src/DicomWebClient/Services/ServiceBase.cs index 6425c559e..cbe1f2154 100644 --- a/src/DicomWebClient/Services/ServiceBase.cs +++ b/src/DicomWebClient/Services/ServiceBase.cs @@ -44,7 +44,7 @@ protected ServiceBase(HttpClient httpClient, ILogger logger = null) public bool TryConfigureServiceUriPrefix(string uriPrefix) { - Guard.Against.NullOrWhiteSpace(uriPrefix); + Guard.Against.NullOrWhiteSpace(uriPrefix, nameof(uriPrefix)); if (HttpClient.BaseAddress is null) { diff --git a/src/DicomWebClient/Services/StowService.cs b/src/DicomWebClient/Services/StowService.cs index c64986a75..44e44dbef 100644 --- a/src/DicomWebClient/Services/StowService.cs +++ b/src/DicomWebClient/Services/StowService.cs @@ -45,7 +45,7 @@ public StowService(HttpClient httpClient, ILogger logger = null) /// public async Task> Store(string studyInstanceUid, IEnumerable dicomFiles, CancellationToken cancellationToken = default) { - Guard.Against.NullOrEmpty(dicomFiles); + Guard.Against.NullOrEmpty(dicomFiles, nameof(dicomFiles)); var postUri = GetStudiesUri(studyInstanceUid); diff --git a/src/DicomWebClient/Services/WadoService.cs b/src/DicomWebClient/Services/WadoService.cs index 67250e67a..175a36f52 100644 --- a/src/DicomWebClient/Services/WadoService.cs +++ b/src/DicomWebClient/Services/WadoService.cs @@ -41,7 +41,7 @@ public async IAsyncEnumerable Retrieve( string studyInstanceUid, params DicomTransferSyntax[] transferSyntaxes) { - Guard.Against.NullOrWhiteSpace(studyInstanceUid); + Guard.Against.NullOrWhiteSpace(studyInstanceUid, nameof(studyInstanceUid)); DicomValidation.ValidateUI(studyInstanceUid); var studyUri = GetStudiesUri(studyInstanceUid); @@ -66,9 +66,9 @@ public async IAsyncEnumerable Retrieve( string seriesInstanceUid, params DicomTransferSyntax[] transferSyntaxes) { - Guard.Against.NullOrWhiteSpace(studyInstanceUid); + Guard.Against.NullOrWhiteSpace(studyInstanceUid, nameof(studyInstanceUid)); DicomValidation.ValidateUI(studyInstanceUid); - Guard.Against.NullOrWhiteSpace(seriesInstanceUid); + Guard.Against.NullOrWhiteSpace(seriesInstanceUid, nameof(seriesInstanceUid)); DicomValidation.ValidateUI(seriesInstanceUid); var seriesUri = GetSeriesUri(studyInstanceUid, seriesInstanceUid); @@ -94,11 +94,11 @@ public async Task Retrieve( string sopInstanceUid, params DicomTransferSyntax[] transferSyntaxes) { - Guard.Against.NullOrWhiteSpace(studyInstanceUid); + Guard.Against.NullOrWhiteSpace(studyInstanceUid, nameof(studyInstanceUid)); DicomValidation.ValidateUI(studyInstanceUid); - Guard.Against.NullOrWhiteSpace(seriesInstanceUid); + Guard.Against.NullOrWhiteSpace(seriesInstanceUid, nameof(seriesInstanceUid)); DicomValidation.ValidateUI(seriesInstanceUid); - Guard.Against.NullOrWhiteSpace(sopInstanceUid); + Guard.Against.NullOrWhiteSpace(sopInstanceUid, nameof(sopInstanceUid)); DicomValidation.ValidateUI(sopInstanceUid); var instanceUri = GetInstanceUri(studyInstanceUid, seriesInstanceUid, sopInstanceUid); @@ -153,11 +153,11 @@ public async Task Retrieve( Tuple byteRange = null, params DicomTransferSyntax[] transferSyntaxes) { - Guard.Against.NullOrWhiteSpace(studyInstanceUid); + Guard.Against.NullOrWhiteSpace(studyInstanceUid, nameof(studyInstanceUid)); DicomValidation.ValidateUI(studyInstanceUid); - Guard.Against.NullOrWhiteSpace(seriesInstanceUid); + Guard.Against.NullOrWhiteSpace(seriesInstanceUid, nameof(seriesInstanceUid)); DicomValidation.ValidateUI(seriesInstanceUid); - Guard.Against.NullOrWhiteSpace(sopInstanceUid); + Guard.Against.NullOrWhiteSpace(sopInstanceUid, nameof(sopInstanceUid)); DicomValidation.ValidateUI(sopInstanceUid); return await Retrieve(new Uri($"{RequestServicePrefix}studies/{studyInstanceUid}/series/{seriesInstanceUid}/instances/{sopInstanceUid}/bulk/{dicomTag.Group:X4}{dicomTag.Element:X4}", UriKind.Relative), byteRange, transferSyntaxes); @@ -175,7 +175,7 @@ public async Task Retrieve( Tuple byteRange = null, params DicomTransferSyntax[] transferSyntaxes) { - Guard.Against.Null(bulkdataUri); + Guard.Against.Null(bulkdataUri, nameof(bulkdataUri)); if (bulkdataUri.IsAbsoluteUri) { @@ -200,7 +200,7 @@ public async Task Retrieve( public async IAsyncEnumerable RetrieveMetadata( string studyInstanceUid) { - Guard.Against.NullOrWhiteSpace(studyInstanceUid); + Guard.Against.NullOrWhiteSpace(studyInstanceUid, nameof(studyInstanceUid)); DicomValidation.ValidateUI(studyInstanceUid); var studyUri = GetStudiesUri(studyInstanceUid); var studyMetadataUri = new Uri($"{studyUri}metadata", UriKind.Relative); @@ -217,9 +217,9 @@ public async IAsyncEnumerable RetrieveMetadata( string studyInstanceUid, string seriesInstanceUid) { - Guard.Against.NullOrWhiteSpace(studyInstanceUid); + Guard.Against.NullOrWhiteSpace(studyInstanceUid, nameof(studyInstanceUid)); DicomValidation.ValidateUI(studyInstanceUid); - Guard.Against.NullOrWhiteSpace(seriesInstanceUid); + Guard.Against.NullOrWhiteSpace(seriesInstanceUid, nameof(seriesInstanceUid)); DicomValidation.ValidateUI(seriesInstanceUid); var seriesUri = GetSeriesUri(studyInstanceUid, seriesInstanceUid); @@ -237,11 +237,11 @@ public async Task RetrieveMetadata( string seriesInstanceUid, string sopInstanceUid) { - Guard.Against.NullOrWhiteSpace(studyInstanceUid); + Guard.Against.NullOrWhiteSpace(studyInstanceUid, nameof(studyInstanceUid)); DicomValidation.ValidateUI(studyInstanceUid); - Guard.Against.NullOrWhiteSpace(seriesInstanceUid); + Guard.Against.NullOrWhiteSpace(seriesInstanceUid, nameof(seriesInstanceUid)); DicomValidation.ValidateUI(seriesInstanceUid); - Guard.Against.NullOrWhiteSpace(sopInstanceUid); + Guard.Against.NullOrWhiteSpace(sopInstanceUid, nameof(sopInstanceUid)); DicomValidation.ValidateUI(sopInstanceUid); var instanceUri = GetInstanceUri(studyInstanceUid, seriesInstanceUid, sopInstanceUid); diff --git a/src/DicomWebClient/Test/Monai.Deploy.InformaticsGateway.DicomWeb.Client.Test.csproj b/src/DicomWebClient/Test/Monai.Deploy.InformaticsGateway.DicomWeb.Client.Test.csproj index 192edecc2..f242df05f 100644 --- a/src/DicomWebClient/Test/Monai.Deploy.InformaticsGateway.DicomWeb.Client.Test.csproj +++ b/src/DicomWebClient/Test/Monai.Deploy.InformaticsGateway.DicomWeb.Client.Test.csproj @@ -26,7 +26,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/DicomWebClient/Test/packages.lock.json b/src/DicomWebClient/Test/packages.lock.json index 098074af8..4ff60c06a 100644 --- a/src/DicomWebClient/Test/packages.lock.json +++ b/src/DicomWebClient/Test/packages.lock.json @@ -4,12 +4,9 @@ "net6.0": { "Ardalis.GuardClauses": { "type": "Direct", - "requested": "[4.0.1, )", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "requested": "[4.1.1, )", + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "coverlet.collector": { "type": "Direct", @@ -86,11 +83,6 @@ "System.Threading.Channels": "6.0.0" } }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Microsoft.AspNet.WebApi.Client": { "type": "Transitive", "resolved": "5.2.9", @@ -1208,14 +1200,14 @@ "monai.deploy.informaticsgateway.client.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.Text.Json": "[6.0.7, )" } }, "monai.deploy.informaticsgateway.dicomweb.client": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "Microsoft.AspNet.WebApi.Client": "[5.2.9, )", "Microsoft.Extensions.Http": "[6.0.0, )", "Microsoft.Net.Http.Headers": "[2.2.8, )", diff --git a/src/DicomWebClient/packages.lock.json b/src/DicomWebClient/packages.lock.json index de6c58765..4724ed08b 100644 --- a/src/DicomWebClient/packages.lock.json +++ b/src/DicomWebClient/packages.lock.json @@ -4,12 +4,9 @@ "net6.0": { "Ardalis.GuardClauses": { "type": "Direct", - "requested": "[4.0.1, )", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "requested": "[4.1.1, )", + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "fo-dicom": { "type": "Direct", @@ -69,11 +66,6 @@ "Microsoft.Bcl.AsyncInterfaces": "6.0.0" } }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Microsoft.Bcl.AsyncInterfaces": { "type": "Transitive", "resolved": "6.0.0", @@ -1248,7 +1240,7 @@ "monai.deploy.informaticsgateway.client.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.Text.Json": "[6.0.7, )" } } diff --git a/src/InformaticsGateway/Common/DicomExtensions.cs b/src/InformaticsGateway/Common/DicomExtensions.cs index 958faaadc..bd9eddb66 100644 --- a/src/InformaticsGateway/Common/DicomExtensions.cs +++ b/src/InformaticsGateway/Common/DicomExtensions.cs @@ -54,7 +54,7 @@ public static DicomTransferSyntax[] ToDicomTransferSyntaxArray(this IEnumerable< public static string ToJson(this DicomFile dicomFile, DicomJsonOptions dicomJsonOptions, bool validateDicom) { - Guard.Against.Null(dicomFile); + Guard.Against.Null(dicomFile, nameof(dicomFile)); var options = new JsonSerializerOptions(); options.Converters.Add(new DicomJsonConverter( diff --git a/src/InformaticsGateway/Common/DicomToolkit.cs b/src/InformaticsGateway/Common/DicomToolkit.cs index d78455a73..6f861731b 100644 --- a/src/InformaticsGateway/Common/DicomToolkit.cs +++ b/src/InformaticsGateway/Common/DicomToolkit.cs @@ -19,6 +19,7 @@ using System.Threading.Tasks; using Ardalis.GuardClauses; using FellowOakDicom; +using SharpCompress.Compressors.Xz; namespace Monai.Deploy.InformaticsGateway.Common { @@ -26,14 +27,14 @@ public class DicomToolkit : IDicomToolkit { public Task OpenAsync(Stream stream, FileReadOption fileReadOption = FileReadOption.Default) { - Guard.Against.Null(stream); + Guard.Against.Null(stream, nameof(stream)); return DicomFile.OpenAsync(stream, fileReadOption); } public DicomFile Load(byte[] fileContent) { - Guard.Against.NullOrEmpty(fileContent); + Guard.Against.NullOrEmpty(fileContent, nameof(fileContent)); using var stream = new MemoryStream(fileContent); var dicomFile = DicomFile.Open(stream, FileReadOption.ReadAll); @@ -47,7 +48,7 @@ public DicomFile Load(byte[] fileContent) public StudySerieSopUids GetStudySeriesSopInstanceUids(DicomFile dicomFile) { - Guard.Against.Null(dicomFile); + Guard.Against.Null(dicomFile, nameof(dicomFile)); return new StudySerieSopUids { diff --git a/src/InformaticsGateway/Common/FileStorageMetadataExtensions.cs b/src/InformaticsGateway/Common/FileStorageMetadataExtensions.cs index 7e7abc489..c610680fe 100644 --- a/src/InformaticsGateway/Common/FileStorageMetadataExtensions.cs +++ b/src/InformaticsGateway/Common/FileStorageMetadataExtensions.cs @@ -19,6 +19,7 @@ using System.Threading.Tasks; using Ardalis.GuardClauses; using FellowOakDicom; +using FellowOakDicom.Serialization; using Monai.Deploy.InformaticsGateway.Api.Storage; using Monai.Deploy.InformaticsGateway.Configuration; @@ -34,14 +35,14 @@ public static async Task SetDataStreams( IFileSystem fileSystem = null, string temporaryStoragePath = "") { - Guard.Against.Null(dicomFile); - Guard.Against.Null(dicomJson); // allow empty here + Guard.Against.Null(dicomFile, nameof(dicomFile)); + Guard.Against.Null(dicomJson, nameof(dicomJson)); // allow empty here switch (storageLocation) { case TemporaryDataStorageLocation.Disk: - Guard.Against.Null(fileSystem); - Guard.Against.NullOrWhiteSpace(temporaryStoragePath); + Guard.Against.Null(fileSystem, nameof(fileSystem)); + Guard.Against.NullOrWhiteSpace(temporaryStoragePath, nameof(temporaryStoragePath)); var tempFile = fileSystem.Path.Combine(temporaryStoragePath, $@"{fileSystem.Path.GetRandomFileName()}"); dicomFileStorageMetadata.File.Data = fileSystem.File.Create(tempFile); @@ -81,13 +82,13 @@ private static async Task SetTextStream( IFileSystem fileSystem = null, string temporaryStoragePath = "") { - Guard.Against.Null(message); // allow empty here + Guard.Against.Null(message, nameof(message)); // allow empty here switch (storageLocation) { case TemporaryDataStorageLocation.Disk: - Guard.Against.Null(fileSystem); - Guard.Against.NullOrWhiteSpace(temporaryStoragePath); + Guard.Against.Null(fileSystem, nameof(fileSystem)); + Guard.Against.NullOrWhiteSpace(temporaryStoragePath, nameof(temporaryStoragePath)); var tempFile = fileSystem.Path.Combine(temporaryStoragePath, $@"{fileSystem.Path.GetRandomFileName()}"); var stream = fileSystem.File.Create(tempFile); diff --git a/src/InformaticsGateway/Logging/FoDicomLogManager.cs b/src/InformaticsGateway/Logging/FoDicomLogManager.cs index 4a5fea845..b30af764a 100644 --- a/src/InformaticsGateway/Logging/FoDicomLogManager.cs +++ b/src/InformaticsGateway/Logging/FoDicomLogManager.cs @@ -32,7 +32,7 @@ public FoDicomLogManager(ILoggerFactory loggerFactory) protected override Logger GetLoggerImpl(string name) { - Guard.Against.NullOrWhiteSpace(name); + Guard.Against.NullOrWhiteSpace(name, nameof(name)); return new MicrosoftLoggerAdapter(_loggerFactory.CreateLogger(name)); } diff --git a/src/InformaticsGateway/Logging/MicrosoftLoggerAdapter.cs b/src/InformaticsGateway/Logging/MicrosoftLoggerAdapter.cs index 886bca461..ac75fb4e9 100644 --- a/src/InformaticsGateway/Logging/MicrosoftLoggerAdapter.cs +++ b/src/InformaticsGateway/Logging/MicrosoftLoggerAdapter.cs @@ -16,6 +16,7 @@ */ using System; +using System.Xml.Linq; using Ardalis.GuardClauses; using FellowOakDicom.Log; using Microsoft.Extensions.Logging; @@ -33,7 +34,7 @@ public class MicrosoftLoggerAdapter : Logger public override void Log(FellowOakDicom.Log.LogLevel level, string msg, params object[] args) { - Guard.Against.NullOrWhiteSpace(msg); + Guard.Against.NullOrWhiteSpace(msg, nameof(msg)); _logger.Log(level.ToMicrosoftExtensionsLogLevel(), msg, args); } diff --git a/src/InformaticsGateway/Monai.Deploy.InformaticsGateway.csproj b/src/InformaticsGateway/Monai.Deploy.InformaticsGateway.csproj index 86c02d30c..7ca2a5e35 100644 --- a/src/InformaticsGateway/Monai.Deploy.InformaticsGateway.csproj +++ b/src/InformaticsGateway/Monai.Deploy.InformaticsGateway.csproj @@ -35,7 +35,7 @@ - + diff --git a/src/InformaticsGateway/Repositories/MonaiServiceLocator.cs b/src/InformaticsGateway/Repositories/MonaiServiceLocator.cs index e94c9eeea..8e42fa2d7 100644 --- a/src/InformaticsGateway/Repositories/MonaiServiceLocator.cs +++ b/src/InformaticsGateway/Repositories/MonaiServiceLocator.cs @@ -49,7 +49,7 @@ public Dictionary GetServiceStatus() private IMonaiService GetService(Type type) { - Guard.Against.Null(type); + Guard.Against.Null(type, nameof(type)); return _serviceProvider.GetService(type) as IMonaiService; } diff --git a/src/InformaticsGateway/Services/Common/ITcpListener.cs b/src/InformaticsGateway/Services/Common/ITcpListener.cs index 83fac6edb..d3e37bda3 100644 --- a/src/InformaticsGateway/Services/Common/ITcpListener.cs +++ b/src/InformaticsGateway/Services/Common/ITcpListener.cs @@ -36,7 +36,7 @@ internal class TcpListener : ITcpListener public TcpListener(IPAddress ipAddress, int port) { - Guard.Against.Null(ipAddress); + Guard.Against.Null(ipAddress, nameof(ipAddress)); _tcpListener = new System.Net.Sockets.TcpListener(ipAddress, port); } diff --git a/src/InformaticsGateway/Services/Connectors/DataRetrievalService.cs b/src/InformaticsGateway/Services/Connectors/DataRetrievalService.cs index c664e9aeb..744baf7eb 100644 --- a/src/InformaticsGateway/Services/Connectors/DataRetrievalService.cs +++ b/src/InformaticsGateway/Services/Connectors/DataRetrievalService.cs @@ -154,7 +154,7 @@ private async Task BackgroundProcessing(CancellationToken cancellationToken) private async Task ProcessRequest(InferenceRequest inferenceRequest, CancellationToken cancellationToken) { - Guard.Against.Null(inferenceRequest); + Guard.Against.Null(inferenceRequest, nameof(inferenceRequest)); var retrievedFiles = new Dictionary(StringComparer.OrdinalIgnoreCase); await RestoreExistingInstances(inferenceRequest, retrievedFiles, cancellationToken).ConfigureAwait(false); @@ -185,7 +185,7 @@ private async Task ProcessRequest(InferenceRequest inferenceRequest, Cancellatio private async Task NotifyNewInstance(InferenceRequest inferenceRequest, Dictionary retrievedFiles) { - Guard.Against.Null(inferenceRequest); + Guard.Against.Null(inferenceRequest, nameof(inferenceRequest)); if (retrievedFiles.IsNullOrEmpty()) { @@ -208,8 +208,8 @@ private async Task NotifyNewInstance(InferenceRequest inferenceRequest, Dictiona private async Task RestoreExistingInstances(InferenceRequest inferenceRequest, Dictionary retrievedInstances, CancellationToken cancellationToken) { - Guard.Against.Null(inferenceRequest); - Guard.Against.Null(retrievedInstances); + Guard.Against.Null(inferenceRequest, nameof(inferenceRequest)); + Guard.Against.Null(retrievedInstances, nameof(retrievedInstances)); using var scope = _serviceScopeFactory.CreateScope(); @@ -239,8 +239,8 @@ private async Task RestoreExistingInstances(InferenceRequest inferenceRequest, D private async Task RetrieveViaFhir(InferenceRequest inferenceRequest, RequestInputDataResource source, Dictionary retrievedResources, CancellationToken cancellationToken) { - Guard.Against.Null(inferenceRequest); - Guard.Against.Null(retrievedResources); + Guard.Against.Null(inferenceRequest, nameof(inferenceRequest)); + Guard.Against.Null(retrievedResources, nameof(retrievedResources)); foreach (var input in inferenceRequest.InputMetadata.Inputs) { @@ -258,10 +258,10 @@ private async Task RetrieveViaFhir(InferenceRequest inferenceRequest, RequestInp private async Task RetrieveFhirResources(string transactionId, InferenceRequestDetails requestDetails, RequestInputDataResource source, Dictionary retrievedResources, CancellationToken cancellationToken) { - Guard.Against.NullOrWhiteSpace(transactionId); - Guard.Against.Null(requestDetails); - Guard.Against.Null(source); - Guard.Against.Null(retrievedResources); + Guard.Against.NullOrWhiteSpace(transactionId, nameof(transactionId)); + Guard.Against.Null(requestDetails, nameof(requestDetails)); + Guard.Against.Null(source, nameof(source)); + Guard.Against.Null(retrievedResources, nameof(retrievedResources)); var pendingResources = new Queue(requestDetails.Resources.Where(p => !p.IsRetrieved)); @@ -307,12 +307,12 @@ private async Task RetrieveFhirResources(string transactionId, InferenceRequestD private async Task RetrieveFhirResource(string transactionId, HttpClient httpClient, FhirResource resource, RequestInputDataResource source, Dictionary retrievedResources, FhirStorageFormat fhirFormat, string acceptHeader, CancellationToken cancellationToken) { - Guard.Against.NullOrWhiteSpace(transactionId); - Guard.Against.Null(httpClient); - Guard.Against.Null(resource); - Guard.Against.Null(source); - Guard.Against.Null(retrievedResources); - Guard.Against.NullOrWhiteSpace(acceptHeader); + Guard.Against.NullOrWhiteSpace(transactionId, nameof(transactionId)); + Guard.Against.Null(httpClient, nameof(httpClient)); + Guard.Against.Null(resource, nameof(resource)); + Guard.Against.Null(source, nameof(source)); + Guard.Against.Null(retrievedResources, nameof(retrievedResources)); + Guard.Against.NullOrWhiteSpace(acceptHeader, nameof(acceptHeader)); var id = $"{resource.Type}/{resource.Id}"; if (retrievedResources.ContainsKey(id)) @@ -358,8 +358,8 @@ private async Task RetrieveFhirResource(string transactionId, HttpClient h private async Task RetrieveViaDicomWeb(InferenceRequest inferenceRequest, RequestInputDataResource source, Dictionary retrievedInstance, CancellationToken cancellationToken) { - Guard.Against.Null(inferenceRequest); - Guard.Against.Null(retrievedInstance); + Guard.Against.Null(inferenceRequest, nameof(inferenceRequest)); + Guard.Against.Null(retrievedInstance, nameof(retrievedInstance)); var authenticationHeaderValue = AuthenticationHeaderValueExtensions.ConvertFrom(source.ConnectionDetails.AuthType, source.ConnectionDetails.AuthId); @@ -405,12 +405,12 @@ private async Task RetrieveViaDicomWeb(InferenceRequest inferenceRequest, Reques private async Task QueryStudies(string transactionId, DicomWebClient dicomWebClient, InferenceRequest inferenceRequest, Dictionary retrievedInstance, string dicomTag, string queryValue, CancellationToken cancellationToken) { - Guard.Against.NullOrWhiteSpace(transactionId); - Guard.Against.Null(dicomWebClient); - Guard.Against.Null(inferenceRequest); - Guard.Against.Null(retrievedInstance); - Guard.Against.NullOrWhiteSpace(dicomTag); - Guard.Against.NullOrWhiteSpace(queryValue); + Guard.Against.NullOrWhiteSpace(transactionId, nameof(transactionId)); + Guard.Against.Null(dicomWebClient, nameof(dicomWebClient)); + Guard.Against.Null(inferenceRequest, nameof(inferenceRequest)); + Guard.Against.Null(retrievedInstance, nameof(retrievedInstance)); + Guard.Against.NullOrWhiteSpace(dicomTag, nameof(dicomTag)); + Guard.Against.NullOrWhiteSpace(queryValue, nameof(queryValue)); _logger.PerformQido(dicomTag, queryValue); var queryParams = new Dictionary(StringComparer.OrdinalIgnoreCase) @@ -448,9 +448,9 @@ private async Task QueryStudies(string transactionId, DicomWebClient dicomWebCli private async Task RetrieveStudies(string transactionId, IDicomWebClient dicomWebClient, IList studies, Dictionary retrievedInstance, CancellationToken cancellationToken) { - Guard.Against.NullOrWhiteSpace(transactionId); - Guard.Against.Null(studies); - Guard.Against.Null(retrievedInstance); + Guard.Against.NullOrWhiteSpace(transactionId, nameof(transactionId)); + Guard.Against.Null(studies, nameof(studies)); + Guard.Against.Null(retrievedInstance, nameof(retrievedInstance)); foreach (var study in studies) { @@ -473,9 +473,9 @@ private async Task RetrieveStudies(string transactionId, IDicomWebClient dicomWe private async Task RetrieveSeries(string transactionId, IDicomWebClient dicomWebClient, RequestedStudy study, Dictionary retrievedInstance, CancellationToken cancellationToken) { - Guard.Against.NullOrWhiteSpace(transactionId); - Guard.Against.Null(study); - Guard.Against.Null(retrievedInstance); + Guard.Against.NullOrWhiteSpace(transactionId, nameof(transactionId)); + Guard.Against.Null(study, nameof(study)); + Guard.Against.Null(retrievedInstance, nameof(retrievedInstance)); foreach (var series in study.Series) { @@ -498,10 +498,10 @@ private async Task RetrieveSeries(string transactionId, IDicomWebClient dicomWeb private async Task RetrieveInstances(string transactionId, IDicomWebClient dicomWebClient, string studyInstanceUid, RequestedSeries series, Dictionary retrievedInstance, CancellationToken cancellationToken) { - Guard.Against.NullOrWhiteSpace(transactionId); - Guard.Against.NullOrWhiteSpace(studyInstanceUid); - Guard.Against.Null(series); - Guard.Against.Null(retrievedInstance); + Guard.Against.NullOrWhiteSpace(transactionId, nameof(transactionId)); + Guard.Against.NullOrWhiteSpace(studyInstanceUid, nameof(studyInstanceUid)); + Guard.Against.Null(series, nameof(series)); + Guard.Against.Null(retrievedInstance, nameof(retrievedInstance)); var count = retrievedInstance.Count; foreach (var instance in series.Instances) @@ -533,9 +533,9 @@ private async Task RetrieveInstances(string transactionId, IDicomWebClient dicom private async Task SaveFiles(string transactionId, IAsyncEnumerable files, Dictionary retrievedInstance, CancellationToken cancellationToken) { - Guard.Against.NullOrWhiteSpace(transactionId); - Guard.Against.Null(files); - Guard.Against.Null(retrievedInstance); + Guard.Against.NullOrWhiteSpace(transactionId, nameof(transactionId)); + Guard.Against.Null(files, nameof(files)); + Guard.Against.Null(retrievedInstance, nameof(retrievedInstance)); var count = retrievedInstance.Count; await foreach (var file in files) @@ -561,8 +561,8 @@ private async Task SaveFiles(string transactionId, IAsyncEnumerable f private static DicomFileStorageMetadata SaveFile(string transactionId, DicomFile file, StudySerieSopUids uids) { - Guard.Against.Null(transactionId); - Guard.Against.Null(file); + Guard.Against.Null(transactionId, nameof(transactionId)); + Guard.Against.Null(file, nameof(file)); return new DicomFileStorageMetadata(transactionId, uids.Identifier, uids.StudyInstanceUid, uids.SeriesInstanceUid, uids.SopInstanceUid) { diff --git a/src/InformaticsGateway/Services/Connectors/PayloadAssembler.cs b/src/InformaticsGateway/Services/Connectors/PayloadAssembler.cs index 83bf3973e..0e7aed93c 100644 --- a/src/InformaticsGateway/Services/Connectors/PayloadAssembler.cs +++ b/src/InformaticsGateway/Services/Connectors/PayloadAssembler.cs @@ -97,7 +97,7 @@ private async Task RemovePendingPayloads() /// Number of seconds the bucket shall wait before sending the payload to be processed. Note: timeout cannot be modified once the bucket is created. public async Task Queue(string bucket, FileStorageMetadata file, uint timeout) { - Guard.Against.Null(file); + Guard.Against.Null(file, nameof(file)); await _intializedTask.ConfigureAwait(false); diff --git a/src/InformaticsGateway/Services/Connectors/PayloadMoveActionHandler.cs b/src/InformaticsGateway/Services/Connectors/PayloadMoveActionHandler.cs index 0906f8f4f..a951dc21e 100644 --- a/src/InformaticsGateway/Services/Connectors/PayloadMoveActionHandler.cs +++ b/src/InformaticsGateway/Services/Connectors/PayloadMoveActionHandler.cs @@ -65,9 +65,9 @@ public PayloadMoveActionHandler(IServiceScopeFactory serviceScopeFactory, public async Task MoveFilesAsync(Payload payload, ActionBlock moveQueue, ActionBlock notificationQueue, CancellationToken cancellationToken = default) { - Guard.Against.Null(payload); - Guard.Against.Null(moveQueue); - Guard.Against.Null(notificationQueue); + Guard.Against.Null(payload, nameof(payload)); + Guard.Against.Null(moveQueue, nameof(moveQueue)); + Guard.Against.Null(notificationQueue, nameof(notificationQueue)); if (payload.State != Payload.PayloadState.Move) { @@ -100,8 +100,8 @@ public async Task MoveFilesAsync(Payload payload, ActionBlock moveQueue private async Task NotifyIfCompleted(Payload payload, ActionBlock notificationQueue, CancellationToken cancellationToken = default) { - Guard.Against.Null(payload); - Guard.Against.Null(notificationQueue); + Guard.Against.Null(payload, nameof(payload)); + Guard.Against.Null(notificationQueue, nameof(notificationQueue)); if (payload.IsMoveCompleted()) { @@ -128,7 +128,7 @@ private async Task NotifyIfCompleted(Payload payload, ActionBlock notif private async Task UpdatePayloadState(Payload payload, Exception ex, CancellationToken cancellationToken = default) { - Guard.Against.Null(payload); + Guard.Against.Null(payload, nameof(payload)); var scope = _serviceScopeFactory.CreateScope(); var repository = scope.ServiceProvider.GetService() ?? throw new ServiceNotFoundException(nameof(IPayloadRepository)); diff --git a/src/InformaticsGateway/Services/Connectors/PayloadNotificationActionHandler.cs b/src/InformaticsGateway/Services/Connectors/PayloadNotificationActionHandler.cs index cc685665f..9d6e2d670 100644 --- a/src/InformaticsGateway/Services/Connectors/PayloadNotificationActionHandler.cs +++ b/src/InformaticsGateway/Services/Connectors/PayloadNotificationActionHandler.cs @@ -61,8 +61,8 @@ public PayloadNotificationActionHandler(IServiceScopeFactory serviceScopeFactory public async Task NotifyAsync(Payload payload, ActionBlock notificationQueue, CancellationToken cancellationToken = default) { - Guard.Against.Null(payload); - Guard.Against.Null(notificationQueue); + Guard.Against.Null(payload, nameof(payload)); + Guard.Against.Null(notificationQueue, nameof(notificationQueue)); if (payload.State != Payload.PayloadState.Notify) { @@ -91,7 +91,7 @@ public async Task NotifyAsync(Payload payload, ActionBlock notification private async Task DeletePayload(Payload payload, CancellationToken cancellationToken = default) { - Guard.Against.Null(payload); + Guard.Against.Null(payload, nameof(payload)); var scope = _serviceScopeFactory.CreateScope(); var repository = scope.ServiceProvider.GetService() ?? throw new ServiceNotFoundException(nameof(IPayloadRepository)); @@ -100,7 +100,7 @@ private async Task DeletePayload(Payload payload, CancellationToken cancellation private async Task NotifyPayloadReady(Payload payload) { - Guard.Against.Null(payload); + Guard.Against.Null(payload, nameof(payload)); _logger.GenerateWorkflowRequest(payload.PayloadId); @@ -136,7 +136,7 @@ await messageBrokerPublisherService.Publish( private async Task UpdatePayloadState(Payload payload, CancellationToken cancellationToken = default) { - Guard.Against.Null(payload); + Guard.Against.Null(payload, nameof(payload)); var scope = _serviceScopeFactory.CreateScope(); var repository = scope.ServiceProvider.GetService() ?? throw new ServiceNotFoundException(nameof(IPayloadRepository)); diff --git a/src/InformaticsGateway/Services/Connectors/PayloadNotificationService.cs b/src/InformaticsGateway/Services/Connectors/PayloadNotificationService.cs index 1b429f9be..a190ddfad 100644 --- a/src/InformaticsGateway/Services/Connectors/PayloadNotificationService.cs +++ b/src/InformaticsGateway/Services/Connectors/PayloadNotificationService.cs @@ -151,7 +151,7 @@ private void ResetMoveQueue(CancellationToken cancellationToken) private async Task NotificationHandler(Payload payload) { - Guard.Against.Null(payload); + Guard.Against.Null(payload, nameof(payload)); using var loggerScope = _logger.BeginScope(new LoggingDataDictionary { { "Payload", payload.PayloadId }, { "CorrelationId", payload.CorrelationId } }); @@ -179,7 +179,7 @@ private async Task NotificationHandler(Payload payload) private async Task MoveActionHandler(Payload payload) { - Guard.Against.Null(payload); + Guard.Against.Null(payload, nameof(payload)); using var loggerScope = _logger.BeginScope(new LoggingDataDictionary { { "Payload", payload.PayloadId }, { "CorrelationId", payload.CorrelationId } }); @@ -207,7 +207,7 @@ private async Task MoveActionHandler(Payload payload) private void HandlePostPayloadException(PostPayloadException ex) { - Guard.Against.Null(ex); + Guard.Against.Null(ex, nameof(ex)); if (ex.TargetQueue == Payload.PayloadState.Move) { @@ -265,8 +265,8 @@ private void BackgroundProcessing(CancellationToken cancellationToken) private static void ResetIfFaultedOrCancelled(ActionBlock queue, Action resetFunction, CancellationToken cancellationToken) { - Guard.Against.Null(queue); - Guard.Against.Null(resetFunction); + Guard.Against.Null(queue, nameof(queue)); + Guard.Against.Null(resetFunction, nameof(resetFunction)); if (queue.Completion.IsCanceledOrFaulted()) { diff --git a/src/InformaticsGateway/Services/DicomWeb/DicomInstanceReaderBase.cs b/src/InformaticsGateway/Services/DicomWeb/DicomInstanceReaderBase.cs index 3452dbf85..ae83d4cc7 100644 --- a/src/InformaticsGateway/Services/DicomWeb/DicomInstanceReaderBase.cs +++ b/src/InformaticsGateway/Services/DicomWeb/DicomInstanceReaderBase.cs @@ -51,7 +51,7 @@ protected DicomInstanceReaderBase( protected static void ValidateSupportedMediaTypes(string contentType, out MediaTypeHeaderValue mediaTypeHeaderValue, params string[] contentTypes) { - Guard.Against.Null(contentType); + Guard.Against.Null(contentType, nameof(contentType)); if (MediaTypeHeaderValue.TryParse(contentType, out var mediaType) && contentTypes.Any(p => p.Equals(mediaType.MediaType.ToString(), StringComparison.OrdinalIgnoreCase))) @@ -65,8 +65,8 @@ protected static void ValidateSupportedMediaTypes(string contentType, out MediaT protected async Task ConvertStream(HttpContext httpContext, Stream sourceStream, CancellationToken cancellationToken = default) { - Guard.Against.Null(httpContext); - Guard.Against.Null(sourceStream); + Guard.Against.Null(httpContext, nameof(httpContext)); + Guard.Against.Null(sourceStream, nameof(sourceStream)); Stream seekableStream; if (!sourceStream.CanSeek) diff --git a/src/InformaticsGateway/Services/DicomWeb/IStreamsWriter.cs b/src/InformaticsGateway/Services/DicomWeb/IStreamsWriter.cs index 1c3cfad60..a9956ef0a 100644 --- a/src/InformaticsGateway/Services/DicomWeb/IStreamsWriter.cs +++ b/src/InformaticsGateway/Services/DicomWeb/IStreamsWriter.cs @@ -74,9 +74,9 @@ public StreamsWriter( public async Task Save(IList streams, string studyInstanceUid, string workflowName, string correlationId, string dataSource, CancellationToken cancellationToken = default) { - Guard.Against.NullOrEmpty(streams); - Guard.Against.NullOrWhiteSpace(correlationId); - Guard.Against.NullOrWhiteSpace(dataSource); + Guard.Against.NullOrEmpty(streams, nameof(streams)); + Guard.Against.NullOrWhiteSpace(correlationId, nameof(correlationId)); + Guard.Against.NullOrWhiteSpace(dataSource, nameof(dataSource)); foreach (var stream in streams) { @@ -127,9 +127,9 @@ private int GetStatusCode(int instancesReceived) private async Task SaveInstance(Stream stream, string studyInstanceUid, string workflowName, string correlationId, string dataSource, CancellationToken cancellationToken = default) { - Guard.Against.Null(stream); - Guard.Against.NullOrWhiteSpace(correlationId); - Guard.Against.NullOrWhiteSpace(dataSource); + Guard.Against.Null(stream, nameof(stream)); + Guard.Against.NullOrWhiteSpace(correlationId, nameof(correlationId)); + Guard.Against.NullOrWhiteSpace(dataSource, nameof(dataSource)); stream.Seek(0, SeekOrigin.Begin); DicomFile dicomFile; @@ -212,7 +212,7 @@ private void AddSuccess(DicomStatus warningStatus = null, StudySerieSopUids uids /// private void AddFailure(DicomStatus dicomStatus, StudySerieSopUids uids = default) { - Guard.Against.Null(dicomStatus); + Guard.Against.Null(dicomStatus, nameof(dicomStatus)); _failureCount++; diff --git a/src/InformaticsGateway/Services/DicomWeb/MultipartDicomInstanceReader.cs b/src/InformaticsGateway/Services/DicomWeb/MultipartDicomInstanceReader.cs index efb14a834..f844cf1a3 100644 --- a/src/InformaticsGateway/Services/DicomWeb/MultipartDicomInstanceReader.cs +++ b/src/InformaticsGateway/Services/DicomWeb/MultipartDicomInstanceReader.cs @@ -40,8 +40,8 @@ public MultipartDicomInstanceReader(InformaticsGatewayConfiguration configuratio public async Task> GetStreams(HttpRequest request, MediaTypeHeaderValue mediaTypeHeaderValue, CancellationToken cancellationToken) { - Guard.Against.Null(request); - Guard.Against.Null(mediaTypeHeaderValue); + Guard.Against.Null(request, nameof(request)); + Guard.Against.Null(mediaTypeHeaderValue, nameof(mediaTypeHeaderValue)); var boundary = HeaderUtilities.RemoveQuotes(mediaTypeHeaderValue.Boundary).ToString(); diff --git a/src/InformaticsGateway/Services/DicomWeb/SingleDicomInstanceReader.cs b/src/InformaticsGateway/Services/DicomWeb/SingleDicomInstanceReader.cs index d9f8b5d8a..4b5b13a30 100644 --- a/src/InformaticsGateway/Services/DicomWeb/SingleDicomInstanceReader.cs +++ b/src/InformaticsGateway/Services/DicomWeb/SingleDicomInstanceReader.cs @@ -37,8 +37,8 @@ public SingleDicomInstanceReader(InformaticsGatewayConfiguration configuration, public async Task> GetStreams(HttpRequest request, MediaTypeHeaderValue mediaTypeHeaderValue, CancellationToken cancellationToken) { - Guard.Against.Null(request); - Guard.Against.Null(mediaTypeHeaderValue); + Guard.Against.Null(request, nameof(request)); + Guard.Against.Null(mediaTypeHeaderValue, nameof(mediaTypeHeaderValue)); try { diff --git a/src/InformaticsGateway/Services/DicomWeb/StowService.cs b/src/InformaticsGateway/Services/DicomWeb/StowService.cs index 6ec038ca9..956d80913 100644 --- a/src/InformaticsGateway/Services/DicomWeb/StowService.cs +++ b/src/InformaticsGateway/Services/DicomWeb/StowService.cs @@ -49,8 +49,8 @@ public StowService(IServiceScopeFactory serviceScopeFactory, IOptions StoreAsync(HttpRequest request, string studyInstanceUid, string workflowName, string correlationId, CancellationToken cancellationToken) { - Guard.Against.Null(request); - Guard.Against.NullOrWhiteSpace(correlationId); + Guard.Against.Null(request, nameof(request)); + Guard.Against.NullOrWhiteSpace(correlationId, nameof(correlationId)); if (!string.IsNullOrWhiteSpace(studyInstanceUid)) { @@ -76,7 +76,7 @@ public async Task StoreAsync(HttpRequest request, string studyInstan private IStowRequestReader GetRequestReader(MediaTypeHeaderValue mediaTypeHeaderValue) { - Guard.Against.Null(mediaTypeHeaderValue); + Guard.Against.Null(mediaTypeHeaderValue, nameof(mediaTypeHeaderValue)); var scope = _serviceScopeFactory.CreateScope(); var fileSystem = scope.ServiceProvider.GetService() ?? throw new ServiceNotFoundException(nameof(IFileSystem)); diff --git a/src/InformaticsGateway/Services/Export/DicomWebExportService.cs b/src/InformaticsGateway/Services/Export/DicomWebExportService.cs index 08139b9d6..ec19c1f71 100644 --- a/src/InformaticsGateway/Services/Export/DicomWebExportService.cs +++ b/src/InformaticsGateway/Services/Export/DicomWebExportService.cs @@ -90,9 +90,9 @@ protected override async Task ExportDataBlockCallback( private async Task HandleTransaction(ExportRequestDataMessage exportRequestData, IInferenceRequestRepository repository, string transaction, CancellationToken cancellationToken) { - Guard.Against.Null(exportRequestData); - Guard.Against.Null(repository); - Guard.Against.NullOrWhiteSpace(transaction); + Guard.Against.Null(exportRequestData, nameof(exportRequestData)); + Guard.Against.Null(repository, nameof(repository)); + Guard.Against.NullOrWhiteSpace(transaction, nameof(transaction)); var inferenceRequest = await repository.GetInferenceRequestAsync(transaction, cancellationToken).ConfigureAwait(false); if (inferenceRequest is null) @@ -166,7 +166,7 @@ await Policy private void CheckAndLogResult(DicomWebResponse result) { - Guard.Against.Null(result); + Guard.Against.Null(result, nameof(result)); switch (result.StatusCode) { case System.Net.HttpStatusCode.OK: diff --git a/src/InformaticsGateway/Services/Export/ExportRequestDataMessage.cs b/src/InformaticsGateway/Services/Export/ExportRequestDataMessage.cs index 7f319c9d5..4b0a3baf0 100644 --- a/src/InformaticsGateway/Services/Export/ExportRequestDataMessage.cs +++ b/src/InformaticsGateway/Services/Export/ExportRequestDataMessage.cs @@ -58,13 +58,13 @@ public ExportRequestDataMessage(ExportRequestEvent exportRequest, string filenam public void SetData(byte[] data) { - Guard.Against.Null(data); + Guard.Against.Null(data, nameof(data)); FileContent = data; } public void SetFailed(FileExportStatus fileExportStatus, string errorMessage) { - Guard.Against.NullOrWhiteSpace(errorMessage); + Guard.Against.NullOrWhiteSpace(errorMessage, nameof(errorMessage)); ExportStatus = fileExportStatus; IsFailed = true; diff --git a/src/InformaticsGateway/Services/Export/ExportServiceBase.cs b/src/InformaticsGateway/Services/Export/ExportServiceBase.cs index 55f3ee3f6..a87748e9b 100644 --- a/src/InformaticsGateway/Services/Export/ExportServiceBase.cs +++ b/src/InformaticsGateway/Services/Export/ExportServiceBase.cs @@ -222,7 +222,7 @@ private async Task OnMessageReceivedCallback(MessageReceivedEventArgs eventArgs) // https://github.com/dotnet/runtime/issues/30863 private IEnumerable DownloadPayloadActionCallback(ExportRequestEventDetails exportRequest, CancellationToken cancellationToken) { - Guard.Against.Null(exportRequest); + Guard.Against.Null(exportRequest, nameof(exportRequest)); using var loggerScope = _logger.BeginScope(new Api.LoggingDataDictionary { { "ExportTaskId", exportRequest.ExportTaskId }, { "CorrelationId", exportRequest.CorrelationId } }); var scope = _serviceScopeFactory.CreateScope(); var storageService = scope.ServiceProvider.GetRequiredService(); diff --git a/src/InformaticsGateway/Services/Export/ScuExportService.cs b/src/InformaticsGateway/Services/Export/ScuExportService.cs index 231687e49..c704c859b 100644 --- a/src/InformaticsGateway/Services/Export/ScuExportService.cs +++ b/src/InformaticsGateway/Services/Export/ScuExportService.cs @@ -77,7 +77,7 @@ protected override async Task ExportDataBlockCallback( private async Task HandleDesination(ExportRequestDataMessage exportRequestData, string destinationName, CancellationToken cancellationToken) { - Guard.Against.Null(exportRequestData); + Guard.Against.Null(exportRequestData, nameof(exportRequestData)); var manualResetEvent = new ManualResetEvent(false); DestinationApplicationEntity destination = null; diff --git a/src/InformaticsGateway/Services/Fhir/FhirJsonReader.cs b/src/InformaticsGateway/Services/Fhir/FhirJsonReader.cs index 1f976b8a8..d489ff5d0 100644 --- a/src/InformaticsGateway/Services/Fhir/FhirJsonReader.cs +++ b/src/InformaticsGateway/Services/Fhir/FhirJsonReader.cs @@ -48,8 +48,8 @@ public FhirJsonReader(ILogger logger, IOptions GetContentAsync(HttpRequest request, string correlationId, string resourceType, MediaTypeHeaderValue mediaTypeHeaderValue, CancellationToken cancellationToken) { - Guard.Against.Null(request); - Guard.Against.NullOrWhiteSpace(correlationId); + Guard.Against.Null(request, nameof(request)); + Guard.Against.NullOrWhiteSpace(correlationId, nameof(correlationId)); Guard.Against.NullOrInvalidInput(mediaTypeHeaderValue, nameof(mediaTypeHeaderValue), (value) => { return value.MediaType.Value.Equals(ContentTypes.ApplicationFhirJson, StringComparison.OrdinalIgnoreCase); @@ -83,8 +83,8 @@ public async Task GetContentAsync(HttpRequest request, string c private static string SetIdIfMIssing(string correlationId, JsonNode jsonDoc) { - Guard.Against.NullOrWhiteSpace(correlationId); - Guard.Against.Null(jsonDoc); + Guard.Against.NullOrWhiteSpace(correlationId, nameof(correlationId)); + Guard.Against.Null(jsonDoc, nameof(jsonDoc)); if (string.IsNullOrWhiteSpace(jsonDoc[Resources.PropertyId]?.GetValue())) { diff --git a/src/InformaticsGateway/Services/Fhir/FhirResourceTypesRouteConstraint.cs b/src/InformaticsGateway/Services/Fhir/FhirResourceTypesRouteConstraint.cs index 1c5d30d5b..7a7a54190 100644 --- a/src/InformaticsGateway/Services/Fhir/FhirResourceTypesRouteConstraint.cs +++ b/src/InformaticsGateway/Services/Fhir/FhirResourceTypesRouteConstraint.cs @@ -15,6 +15,7 @@ */ using Ardalis.GuardClauses; +using FellowOakDicom; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; @@ -24,10 +25,10 @@ internal class FhirResourceTypesRouteConstraint : IRouteConstraint { public bool Match(HttpContext httpContext, IRouter route, string routeKey, RouteValueDictionary values, RouteDirection routeDirection) { - Guard.Against.Null(httpContext); - Guard.Against.Null(route); - Guard.Against.NullOrWhiteSpace(routeKey); - Guard.Against.Null(values); + Guard.Against.Null(httpContext, nameof(httpContext)); + Guard.Against.Null(route, nameof(route)); + Guard.Against.NullOrWhiteSpace(routeKey, nameof(routeKey)); + Guard.Against.Null(values, nameof(values)); return (values.TryGetValue(Resources.RouteNameResourceType, out var resourceTypeObject) && resourceTypeObject is string resourceType && diff --git a/src/InformaticsGateway/Services/Fhir/FhirService.cs b/src/InformaticsGateway/Services/Fhir/FhirService.cs index 45b706ce9..9c5158ad0 100644 --- a/src/InformaticsGateway/Services/Fhir/FhirService.cs +++ b/src/InformaticsGateway/Services/Fhir/FhirService.cs @@ -58,8 +58,8 @@ public FhirService(IServiceScopeFactory serviceScopeFactory, IOptions StoreAsync(HttpRequest request, string correlationId, string resourceType, CancellationToken cancellationToken) { - Guard.Against.Null(request); - Guard.Against.NullOrWhiteSpace(correlationId); + Guard.Against.Null(request, nameof(request)); + Guard.Against.NullOrWhiteSpace(correlationId, nameof(correlationId)); if (!MediaTypeHeaderValue.TryParse(request.ContentType, out var mediaTypeHeaderValue)) { @@ -98,7 +98,7 @@ public async Task StoreAsync(HttpRequest request, string correl private IFHirRequestReader GetRequestReader(MediaTypeHeaderValue mediaTypeHeaderValue) { - Guard.Against.Null(mediaTypeHeaderValue); + Guard.Against.Null(mediaTypeHeaderValue, nameof(mediaTypeHeaderValue)); var scope = _serviceScopeFactory.CreateScope(); if (mediaTypeHeaderValue.MediaType.Equals(ContentTypes.ApplicationFhirJson, StringComparison.OrdinalIgnoreCase)) diff --git a/src/InformaticsGateway/Services/Fhir/FhirXmlReader.cs b/src/InformaticsGateway/Services/Fhir/FhirXmlReader.cs index 123e24e20..d936e8d44 100644 --- a/src/InformaticsGateway/Services/Fhir/FhirXmlReader.cs +++ b/src/InformaticsGateway/Services/Fhir/FhirXmlReader.cs @@ -48,8 +48,8 @@ public FhirXmlReader(ILogger logger, IOptions GetContentAsync(HttpRequest request, string correlationId, string resourceType, MediaTypeHeaderValue mediaTypeHeaderValue, CancellationToken cancellationToken) { - Guard.Against.Null(request); - Guard.Against.NullOrWhiteSpace(correlationId); + Guard.Against.Null(request, nameof(request)); + Guard.Against.NullOrWhiteSpace(correlationId, nameof(correlationId)); Guard.Against.NullOrInvalidInput(mediaTypeHeaderValue, nameof(mediaTypeHeaderValue), (value) => { return value.MediaType.Value.Equals(ContentTypes.ApplicationFhirXml, StringComparison.OrdinalIgnoreCase); @@ -95,9 +95,9 @@ public async Task GetContentAsync(HttpRequest request, string c private static string SetIdIfMIssing(string correlationId, XmlNamespaceManager xmlNamespaceManager, XmlElement rootNode) { - Guard.Against.NullOrWhiteSpace(correlationId); - Guard.Against.Null(xmlNamespaceManager); - Guard.Against.Null(rootNode); + Guard.Against.NullOrWhiteSpace(correlationId, nameof(correlationId)); + Guard.Against.Null(xmlNamespaceManager, nameof(xmlNamespaceManager)); + Guard.Against.Null(rootNode, nameof(rootNode)); var idNode = rootNode.SelectSingleNode($"{Resources.XmlNamespacePrefix}:{Resources.PropertyId}", xmlNamespaceManager); if (idNode is null) diff --git a/src/InformaticsGateway/Services/HealthLevel7/MllpClient.cs b/src/InformaticsGateway/Services/HealthLevel7/MllpClient.cs index 4160b8ba9..99d31de31 100644 --- a/src/InformaticsGateway/Services/HealthLevel7/MllpClient.cs +++ b/src/InformaticsGateway/Services/HealthLevel7/MllpClient.cs @@ -72,7 +72,7 @@ public async Task Start(Func onDisconnect, private async Task> ReceiveData(INetworkStream clientStream, CancellationToken cancellationToken) { - Guard.Against.Null(clientStream); + Guard.Against.Null(clientStream, nameof(clientStream)); var data = string.Empty; var messages = new List(); @@ -143,8 +143,8 @@ private async Task> ReceiveData(INetworkStream clientStream, Canc private async Task SendAcknowledgment(INetworkStream clientStream, Message message, CancellationToken cancellationToken) { - Guard.Against.Null(clientStream); - Guard.Against.Null(message); + Guard.Against.Null(clientStream, nameof(clientStream)); + Guard.Against.Null(message, nameof(message)); if (!_configurations.SendAcknowledgment) { @@ -171,7 +171,7 @@ private async Task SendAcknowledgment(INetworkStream clientStream, Message messa private bool ShouldSendAcknowledgment(Message message) { - Guard.Against.Null(message); + Guard.Against.Null(message, nameof(message)); try { var value = message.DefaultSegment(Resources.MessageHeaderSegment).Fields(Resources.AcceptAcknowledgementType); diff --git a/src/InformaticsGateway/Services/HealthLevel7/MllpService.cs b/src/InformaticsGateway/Services/HealthLevel7/MllpService.cs index 5746a9ba6..cb2cde24f 100644 --- a/src/InformaticsGateway/Services/HealthLevel7/MllpService.cs +++ b/src/InformaticsGateway/Services/HealthLevel7/MllpService.cs @@ -25,6 +25,7 @@ using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +using Minio.DataModel; using Monai.Deploy.InformaticsGateway.Api.Rest; using Monai.Deploy.InformaticsGateway.Api.Storage; using Monai.Deploy.InformaticsGateway.Common; @@ -161,8 +162,8 @@ private async Task BackgroundProcessing(CancellationToken cancellationToken) private async Task OnDisconnect(IMllpClient client, MllpClientResult result) { - Guard.Against.Null(client); - Guard.Against.Null(result); + Guard.Against.Null(client, nameof(client)); + Guard.Against.Null(result, nameof(result)); try { diff --git a/src/InformaticsGateway/Services/Http/InferenceController.cs b/src/InformaticsGateway/Services/Http/InferenceController.cs index d0a588bb5..0d599795c 100644 --- a/src/InformaticsGateway/Services/Http/InferenceController.cs +++ b/src/InformaticsGateway/Services/Http/InferenceController.cs @@ -19,6 +19,7 @@ using System.Net; using System.Threading.Tasks; using Ardalis.GuardClauses; +using DotNext; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; @@ -51,7 +52,7 @@ public InferenceController( [ProducesResponseType(StatusCodes.Status500InternalServerError)] public async Task JobStatus(string transactionId) { - Guard.Against.NullOrWhiteSpace(transactionId); + Guard.Against.NullOrWhiteSpace(transactionId, nameof(transactionId)); try { @@ -80,7 +81,7 @@ public async Task JobStatus(string transactionId) [ProducesResponseType(StatusCodes.Status500InternalServerError)] public async Task NewInferenceRequest([FromBody] InferenceRequest request) { - Guard.Against.Null(request); + Guard.Against.Null(request, nameof(request)); if (!request.IsValid(out var details)) { diff --git a/src/InformaticsGateway/Services/Http/MonaiAeTitleController.cs b/src/InformaticsGateway/Services/Http/MonaiAeTitleController.cs index dd74bd426..0a0dac2b6 100644 --- a/src/InformaticsGateway/Services/Http/MonaiAeTitleController.cs +++ b/src/InformaticsGateway/Services/Http/MonaiAeTitleController.cs @@ -19,6 +19,7 @@ using System.Linq; using System.Net.Mime; using System.Threading.Tasks; +using Amazon.Runtime.Internal; using Ardalis.GuardClauses; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -206,7 +207,7 @@ public async Task> Delete(string name) private async Task ValidateCreateAsync(MonaiApplicationEntity item) { - Guard.Against.Null(item); + Guard.Against.Null(item, nameof(item)); if (await _repository.ContainsAsync(p => p.Name.Equals(item.Name), HttpContext.RequestAborted).ConfigureAwait(false)) { diff --git a/src/InformaticsGateway/Services/Scp/ApplicationEntityHandler.cs b/src/InformaticsGateway/Services/Scp/ApplicationEntityHandler.cs index a668bdfcc..291ba46b4 100644 --- a/src/InformaticsGateway/Services/Scp/ApplicationEntityHandler.cs +++ b/src/InformaticsGateway/Services/Scp/ApplicationEntityHandler.cs @@ -20,6 +20,7 @@ using System.Threading.Tasks; using Ardalis.GuardClauses; using FellowOakDicom.Network; +using Microsoft.AspNetCore.Components.Web; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; @@ -54,7 +55,7 @@ public ApplicationEntityHandler( ILogger logger, IOptions options) { - Guard.Against.Null(serviceScopeFactory); + Guard.Against.Null(serviceScopeFactory, nameof(serviceScopeFactory)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _options = options ?? throw new ArgumentNullException(nameof(options)); @@ -67,7 +68,7 @@ public ApplicationEntityHandler( public void Configure(MonaiApplicationEntity monaiApplicationEntity, DicomJsonOptions dicomJsonOptions, bool validateDicomValuesOnJsonSerialization) { - Guard.Against.Null(monaiApplicationEntity); + Guard.Against.Null(monaiApplicationEntity, nameof(monaiApplicationEntity)); if (_configuration is not null && (_configuration.Name != monaiApplicationEntity.Name || @@ -92,11 +93,11 @@ public async Task HandleInstanceAsync(DicomCStoreRequest request, string calledA throw new NotSupportedException("Must call Configure(...) first."); } - Guard.Against.Null(request); - Guard.Against.NullOrWhiteSpace(calledAeTitle); - Guard.Against.NullOrWhiteSpace(callingAeTitle); - Guard.Against.Null(associationId); - Guard.Against.Null(uids); + Guard.Against.Null(request, nameof(request)); + Guard.Against.NullOrWhiteSpace(calledAeTitle, nameof(calledAeTitle)); + Guard.Against.NullOrWhiteSpace(callingAeTitle, nameof(callingAeTitle)); + Guard.Against.Null(associationId, nameof(associationId)); + Guard.Against.Null(uids, nameof(uids)); if (!AcceptsSopClass(uids.SopClassUid)) { @@ -131,7 +132,7 @@ public async Task HandleInstanceAsync(DicomCStoreRequest request, string calledA private bool AcceptsSopClass(string sopClassUid) { - Guard.Against.NullOrWhiteSpace(sopClassUid); + Guard.Against.NullOrWhiteSpace(sopClassUid, nameof(sopClassUid)); if (_configuration.IgnoredSopClasses.Any()) { diff --git a/src/InformaticsGateway/Services/Scp/ApplicationEntityManager.cs b/src/InformaticsGateway/Services/Scp/ApplicationEntityManager.cs index 1e6c777de..46669def1 100644 --- a/src/InformaticsGateway/Services/Scp/ApplicationEntityManager.cs +++ b/src/InformaticsGateway/Services/Scp/ApplicationEntityManager.cs @@ -18,6 +18,7 @@ using System; using System.Collections.Concurrent; using System.Threading.Tasks; +using Amazon.Runtime.Internal; using Ardalis.GuardClauses; using FellowOakDicom.Network; using Microsoft.Extensions.DependencyInjection; @@ -94,7 +95,7 @@ private void OnApplicationStopping() public async Task HandleCStoreRequest(DicomCStoreRequest request, string calledAeTitle, string callingAeTitle, Guid associationId) { - Guard.Against.Null(request); + Guard.Against.Null(request, nameof(request)); await _initializeTask.ConfigureAwait(false); @@ -125,7 +126,7 @@ private async Task HandleInstance(DicomCStoreRequest request, string calledAeTit public async Task IsAeTitleConfiguredAsync(string calledAe) { - Guard.Against.NullOrWhiteSpace(calledAe); + Guard.Against.NullOrWhiteSpace(calledAe, nameof(calledAe)); await _initializeTask.ConfigureAwait(false); return _aeTitles.ContainsKey(calledAe); @@ -155,7 +156,7 @@ private async Task InitializeMonaiAeTitlesAsync() private void AddNewAeTitle(MonaiApplicationEntity entity) { - Guard.Against.Null(entity); + Guard.Against.Null(entity, nameof(entity)); var scope = _serviceScopeFactory.CreateScope(); var handler = scope.ServiceProvider.GetService() ?? throw new ServiceNotFoundException(nameof(IApplicationEntityHandler)); @@ -202,7 +203,7 @@ public void OnError(Exception error) public void OnNext(MonaiApplicationentityChangedEvent applicationChangedEvent) { - Guard.Against.Null(applicationChangedEvent); + Guard.Against.Null(applicationChangedEvent, nameof(applicationChangedEvent)); switch (applicationChangedEvent.Event) { diff --git a/src/InformaticsGateway/Services/Scp/MonaiAeChangedNotificationService.cs b/src/InformaticsGateway/Services/Scp/MonaiAeChangedNotificationService.cs index daa4650a8..970e1e635 100644 --- a/src/InformaticsGateway/Services/Scp/MonaiAeChangedNotificationService.cs +++ b/src/InformaticsGateway/Services/Scp/MonaiAeChangedNotificationService.cs @@ -18,6 +18,7 @@ using System; using System.Collections.Generic; using Ardalis.GuardClauses; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Monai.Deploy.InformaticsGateway.Common; using Monai.Deploy.InformaticsGateway.Logging; @@ -38,7 +39,7 @@ public MonaiAeChangedNotificationService(ILogger observer) { - Guard.Against.Null(observer); + Guard.Against.Null(observer, nameof(observer)); if (!_observers.Contains(observer)) { @@ -50,7 +51,7 @@ public IDisposable Subscribe(IObserver obser public void Notify(MonaiApplicationentityChangedEvent monaiApplicationChangedEvent) { - Guard.Against.Null(monaiApplicationChangedEvent); + Guard.Against.Null(monaiApplicationChangedEvent, nameof(monaiApplicationChangedEvent)); _logger.NotifyAeChanged(_observers.Count, monaiApplicationChangedEvent.Event); diff --git a/src/InformaticsGateway/Services/Scp/ScpService.cs b/src/InformaticsGateway/Services/Scp/ScpService.cs index 0edfd269e..726922e48 100644 --- a/src/InformaticsGateway/Services/Scp/ScpService.cs +++ b/src/InformaticsGateway/Services/Scp/ScpService.cs @@ -52,10 +52,10 @@ public ScpService(IServiceScopeFactory serviceScopeFactory, IHostApplicationLifetime appLifetime, IOptions configuration) { - Guard.Against.Null(serviceScopeFactory); - Guard.Against.Null(applicationEntityManager); - Guard.Against.Null(appLifetime); - Guard.Against.Null(configuration); + Guard.Against.Null(serviceScopeFactory, nameof(serviceScopeFactory)); + Guard.Against.Null(applicationEntityManager, nameof(applicationEntityManager)); + Guard.Against.Null(appLifetime, nameof(appLifetime)); + Guard.Against.Null(configuration, nameof(configuration)); _serviceScope = serviceScopeFactory.CreateScope(); _associationDataProvider = applicationEntityManager; diff --git a/src/InformaticsGateway/Services/Scu/ScuQueue.cs b/src/InformaticsGateway/Services/Scu/ScuQueue.cs index 8213931b4..9fd0a7984 100644 --- a/src/InformaticsGateway/Services/Scu/ScuQueue.cs +++ b/src/InformaticsGateway/Services/Scu/ScuQueue.cs @@ -41,7 +41,7 @@ public ScuWorkRequest Dequeue(CancellationToken cancellationToken) public async Task Queue(ScuWorkRequest request, CancellationToken cancellationToken) { - Guard.Against.Null(request); + Guard.Against.Null(request, nameof(request)); _workItems.Add(request, cancellationToken); return await request.WaitAsync(cancellationToken).ConfigureAwait(false); diff --git a/src/InformaticsGateway/Services/Scu/ScuService.cs b/src/InformaticsGateway/Services/Scu/ScuService.cs index e2b663e03..c20a9f8e9 100644 --- a/src/InformaticsGateway/Services/Scu/ScuService.cs +++ b/src/InformaticsGateway/Services/Scu/ScuService.cs @@ -47,7 +47,7 @@ public ScuService(IServiceScopeFactory serviceScopeFactory, ILogger logger, IOptions configuration) { - Guard.Against.Null(serviceScopeFactory); + Guard.Against.Null(serviceScopeFactory, nameof(serviceScopeFactory)); _scope = serviceScopeFactory.CreateScope(); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); @@ -114,7 +114,7 @@ private async Task Process(ScuWorkRequest request, CancellationToken cancellatio private async Task HandleCEchoRequest(ScuWorkRequest request, CancellationToken cancellationToken) { - Guard.Against.Null(request); + Guard.Against.Null(request, nameof(request)); var scuResponse = new ScuWorkResponse(); var manualResetEvent = new ManualResetEventSlim(); diff --git a/src/InformaticsGateway/Services/Scu/ScuWorkRequest.cs b/src/InformaticsGateway/Services/Scu/ScuWorkRequest.cs index 49e825471..7925c396f 100644 --- a/src/InformaticsGateway/Services/Scu/ScuWorkRequest.cs +++ b/src/InformaticsGateway/Services/Scu/ScuWorkRequest.cs @@ -37,9 +37,9 @@ public class ScuWorkRequest : IDisposable public ScuWorkRequest(string correlationId, RequestType requestType, string hostIp, int port, string aeTitle, CancellationToken cancellationToken) { - Guard.Against.NullOrWhiteSpace(correlationId); - Guard.Against.NullOrWhiteSpace(hostIp); - Guard.Against.NullOrWhiteSpace(aeTitle); + Guard.Against.NullOrWhiteSpace(correlationId, nameof(correlationId)); + Guard.Against.NullOrWhiteSpace(hostIp, nameof(hostIp)); + Guard.Against.NullOrWhiteSpace(aeTitle, nameof(aeTitle)); CorrelationId = correlationId; RequestType = requestType; diff --git a/src/InformaticsGateway/Services/Storage/ObjectUploadQueue.cs b/src/InformaticsGateway/Services/Storage/ObjectUploadQueue.cs index 5040eab68..27f728c95 100644 --- a/src/InformaticsGateway/Services/Storage/ObjectUploadQueue.cs +++ b/src/InformaticsGateway/Services/Storage/ObjectUploadQueue.cs @@ -39,7 +39,7 @@ public ObjectUploadQueue(ILogger logger) public void Queue(FileStorageMetadata file) { - Guard.Against.Null(file); + Guard.Against.Null(file, nameof(file)); _workItems.Enqueue(file); var process = Process.GetCurrentProcess(); diff --git a/src/InformaticsGateway/Services/Storage/ObjectUploadService.cs b/src/InformaticsGateway/Services/Storage/ObjectUploadService.cs index fb30a5d30..7bad9747f 100644 --- a/src/InformaticsGateway/Services/Storage/ObjectUploadService.cs +++ b/src/InformaticsGateway/Services/Storage/ObjectUploadService.cs @@ -145,7 +145,7 @@ public Task StopAsync(CancellationToken cancellationToken) private async Task ProcessObject(int thread, FileStorageMetadata blob) { - Guard.Against.Null(blob); + Guard.Against.Null(blob, nameof(blob)); using var loggerScope = _logger.BeginScope(new LoggingDataDictionary { { "Thread", thread }, { "File ID", blob.Id }, { "CorrelationId", blob.CorrelationId } }); var stopwatch = new Stopwatch(); @@ -179,10 +179,10 @@ private async Task ProcessObject(int thread, FileStorageMetadata blob) private async Task UploadFileAndConfirm(string identifier, StorageObjectMetadata storageObjectMetadata, string source, List workflows, string payloadId, CancellationToken cancellationToken) { - Guard.Against.NullOrWhiteSpace(identifier); - Guard.Against.Null(storageObjectMetadata); - Guard.Against.NullOrWhiteSpace(source); - Guard.Against.Null(workflows); + Guard.Against.NullOrWhiteSpace(identifier, nameof(identifier)); + Guard.Against.Null(storageObjectMetadata, nameof(storageObjectMetadata)); + Guard.Against.NullOrWhiteSpace(source, nameof(source)); + Guard.Against.Null(workflows, nameof(workflows)); if (storageObjectMetadata.IsUploaded) { diff --git a/src/InformaticsGateway/Test/Services/Export/DicomWebExportServiceTest.cs b/src/InformaticsGateway/Test/Services/Export/DicomWebExportServiceTest.cs index 36b2a83f6..cdc7a73c2 100644 --- a/src/InformaticsGateway/Test/Services/Export/DicomWebExportServiceTest.cs +++ b/src/InformaticsGateway/Test/Services/Export/DicomWebExportServiceTest.cs @@ -413,7 +413,7 @@ public async Task CompletesDataflow(HttpStatusCode httpStatusCode) private bool CheckMessage(Message message, ExportStatus exportStatus, FileExportStatus fileExportStatus) { - Guard.Against.Null(message); + Guard.Against.Null(message, nameof(message)); var exportEvent = message.ConvertTo(); return exportEvent.Status == exportStatus && diff --git a/src/InformaticsGateway/Test/Services/Export/ScuExportServiceTest.cs b/src/InformaticsGateway/Test/Services/Export/ScuExportServiceTest.cs index 920d3253d..de253695d 100644 --- a/src/InformaticsGateway/Test/Services/Export/ScuExportServiceTest.cs +++ b/src/InformaticsGateway/Test/Services/Export/ScuExportServiceTest.cs @@ -511,7 +511,7 @@ public async Task ExportCompletes() private bool CheckMessage(Message message, ExportStatus exportStatus, FileExportStatus fileExportStatus) { - Guard.Against.Null(message); + Guard.Against.Null(message, nameof(message)); var exportEvent = message.ConvertTo(); return exportEvent.Status == exportStatus && diff --git a/src/InformaticsGateway/Test/packages.lock.json b/src/InformaticsGateway/Test/packages.lock.json index c01b8d746..d5c7a01e6 100644 --- a/src/InformaticsGateway/Test/packages.lock.json +++ b/src/InformaticsGateway/Test/packages.lock.json @@ -97,11 +97,8 @@ }, "Ardalis.GuardClauses": { "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "AspNetCore.HealthChecks.MongoDb": { "type": "Transitive", @@ -196,11 +193,6 @@ "resolved": "2.35.0", "contentHash": "1yScq0Ju2O/GPBasnr9/uHziKu3CBgh4nOkgJPWatPLTcP4EzUjjaM2hkgjOBMj8pKO0g687UDnj989MvYRLfA==" }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Karambolo.Extensions.Logging.File": { "type": "Transitive", "resolved": "3.4.0", @@ -1897,7 +1889,7 @@ "monai.deploy.informaticsgateway": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "DotNext.Threading": "[4.7.4, )", "HL7-dotnetcore": "[2.35.0, )", "Karambolo.Extensions.Logging.File": "[3.4.0, )", @@ -1941,14 +1933,14 @@ "monai.deploy.informaticsgateway.client.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.Text.Json": "[6.0.7, )" } }, "monai.deploy.informaticsgateway.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.IO.Abstractions": "[17.2.3, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )", "fo-dicom": "[5.0.3, )" @@ -2016,7 +2008,7 @@ "monai.deploy.informaticsgateway.dicomweb.client": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "Microsoft.AspNet.WebApi.Client": "[5.2.9, )", "Microsoft.Extensions.Http": "[6.0.0, )", "Microsoft.Net.Http.Headers": "[2.2.8, )", diff --git a/src/InformaticsGateway/packages.lock.json b/src/InformaticsGateway/packages.lock.json index 5c5e8d40f..487354c6e 100644 --- a/src/InformaticsGateway/packages.lock.json +++ b/src/InformaticsGateway/packages.lock.json @@ -4,12 +4,9 @@ "net6.0": { "Ardalis.GuardClauses": { "type": "Direct", - "requested": "[4.0.1, )", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "requested": "[4.1.1, )", + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "DotNext.Threading": { "type": "Direct", @@ -306,11 +303,6 @@ "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Macross.Json.Extensions": { "type": "Transitive", "resolved": "3.0.0", @@ -1573,14 +1565,14 @@ "monai.deploy.informaticsgateway.client.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.Text.Json": "[6.0.7, )" } }, "monai.deploy.informaticsgateway.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.IO.Abstractions": "[17.2.3, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )", "fo-dicom": "[5.0.3, )" @@ -1648,7 +1640,7 @@ "monai.deploy.informaticsgateway.dicomweb.client": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "Microsoft.AspNet.WebApi.Client": "[5.2.9, )", "Microsoft.Extensions.Http": "[6.0.0, )", "Microsoft.Net.Http.Headers": "[2.2.8, )", diff --git a/tests/Integration.Test/Common/Assertions.cs b/tests/Integration.Test/Common/Assertions.cs index 4d9eea3ee..09012a6bc 100644 --- a/tests/Integration.Test/Common/Assertions.cs +++ b/tests/Integration.Test/Common/Assertions.cs @@ -50,8 +50,8 @@ public Assertions(Configurations configurations, InformaticsGatewayConfiguration internal async Task ShouldHaveUploadedDicomDataToMinio(IReadOnlyList messages, Dictionary fileHashes, Action additionalChecks = null) { - Guard.Against.Null(messages); - Guard.Against.NullOrEmpty(fileHashes); + Guard.Against.Null(messages, nameof(messages)); + Guard.Against.NullOrEmpty(fileHashes, nameof(fileHashes)); var minioClient = GetMinioClient(); @@ -107,7 +107,7 @@ await _retryPolicy.ExecuteAsync(async () => internal async Task ShouldHaveUploadedFhirDataToMinio(IReadOnlyList messages, Dictionary fhirData) { - Guard.Against.Null(messages); + Guard.Against.Null(messages, nameof(messages)); var minioClient = GetMinioClient(); @@ -152,7 +152,7 @@ internal async Task ShouldHaveUploadedFhirDataToMinio(IReadOnlyList mes internal async Task ShouldHaveUploadedHl7ataToMinio(IReadOnlyList messages) { - Guard.Against.Null(messages); + Guard.Against.Null(messages, nameof(messages)); var minioClient = GetMinioClient(); @@ -196,8 +196,8 @@ internal async Task ShouldHaveUploadedHl7ataToMinio(IReadOnlyList messa internal void ShouldHaveCorrectNumberOfWorkflowRequestMessages(DataProvider dataProvider, IReadOnlyList messages, int count) { - Guard.Against.Null(dataProvider); - Guard.Against.Null(messages); + Guard.Against.Null(dataProvider, nameof(dataProvider)); + Guard.Against.Null(messages, nameof(messages)); messages.Should().NotBeNullOrEmpty().And.HaveCount(count); foreach (var message in messages) @@ -224,8 +224,8 @@ internal void ShouldHaveCorrectNumberOfWorkflowRequestMessages(DataProvider data internal void ShouldHaveCorrectNumberOfWorkflowRequestMessagesAndAcrRequest(DataProvider dataProvider, IReadOnlyList messages, int count) { - Guard.Against.Null(dataProvider); - Guard.Against.Null(messages); + Guard.Against.Null(dataProvider, nameof(dataProvider)); + Guard.Against.Null(messages, nameof(messages)); messages.Should().NotBeNullOrEmpty().And.HaveCount(count); @@ -241,8 +241,8 @@ internal void ShouldHaveCorrectNumberOfWorkflowRequestMessagesAndAcrRequest(Data internal void ShouldHaveCorrectNumberOfWorkflowRequestMessagesAndHl7Messages(Hl7Messages hL7Specs, IReadOnlyList messages, int count) { - Guard.Against.Null(hL7Specs); - Guard.Against.Null(messages); + Guard.Against.Null(hL7Specs, nameof(hL7Specs)); + Guard.Against.Null(messages, nameof(messages)); messages.Should().NotBeNullOrEmpty().And.HaveCount(count); diff --git a/tests/Integration.Test/Common/DataProvider.cs b/tests/Integration.Test/Common/DataProvider.cs index 069282473..9d2488e24 100644 --- a/tests/Integration.Test/Common/DataProvider.cs +++ b/tests/Integration.Test/Common/DataProvider.cs @@ -53,7 +53,7 @@ public DataProvider(Configurations configurations, ISpecFlowOutputHelper outputH internal void GenerateDicomData(string modality, int studyCount, int? seriesPerStudy = null) { - Guard.Against.NullOrWhiteSpace(modality); + Guard.Against.NullOrWhiteSpace(modality, nameof(modality)); _outputHelper.WriteLine($"Generating {studyCount} {modality} study"); _configurations.StudySpecs.ContainsKey(modality).Should().BeTrue(); @@ -86,7 +86,7 @@ internal void ReplaceGeneratedDicomDataWithHashes() internal void GenerateAcrRequest(string requestType) { - Guard.Against.NullOrWhiteSpace(requestType); + Guard.Against.NullOrWhiteSpace(requestType, nameof(requestType)); var inferenceRequest = new InferenceRequest(); inferenceRequest.TransactionId = Guid.NewGuid().ToString(); diff --git a/tests/Integration.Test/Common/DicomCEchoDataClient.cs b/tests/Integration.Test/Common/DicomCEchoDataClient.cs index b91a67725..49918c0e2 100644 --- a/tests/Integration.Test/Common/DicomCEchoDataClient.cs +++ b/tests/Integration.Test/Common/DicomCEchoDataClient.cs @@ -38,7 +38,7 @@ public DicomCEchoDataClient(Configurations configurations, InformaticsGatewayCon public async Task SendAsync(DataProvider dataProvider, params object[] args) { - Guard.Against.NullOrEmpty(args); + Guard.Against.NullOrEmpty(args, nameof(args)); var callingAeTitle = args[0].ToString(); var host = args[1].ToString(); diff --git a/tests/Integration.Test/Common/DicomCStoreDataClient.cs b/tests/Integration.Test/Common/DicomCStoreDataClient.cs index 5b4400860..d84b75765 100644 --- a/tests/Integration.Test/Common/DicomCStoreDataClient.cs +++ b/tests/Integration.Test/Common/DicomCStoreDataClient.cs @@ -43,7 +43,7 @@ public DicomCStoreDataClient(Configurations configurations, InformaticsGatewayCo public async Task SendAsync(DataProvider dataProvider, params object[] args) { - Guard.Against.NullOrEmpty(args); + Guard.Against.NullOrEmpty(args, nameof(args)); var callingAeTitle = args[0].ToString(); var host = args[1].ToString(); diff --git a/tests/Integration.Test/Common/DicomWebDataSink.cs b/tests/Integration.Test/Common/DicomWebDataSink.cs index dc7f2e8f2..07ad2ee76 100644 --- a/tests/Integration.Test/Common/DicomWebDataSink.cs +++ b/tests/Integration.Test/Common/DicomWebDataSink.cs @@ -49,8 +49,8 @@ public DicomWebDataClient(Configurations configurations, InformaticsGatewayConfi /// public async Task SendAsync(DataProvider dataProvider, params object[] args) { - Guard.Against.Null(dataProvider); - Guard.Against.Null(args); + Guard.Against.Null(dataProvider, nameof(dataProvider)); + Guard.Against.Null(args, nameof(args)); var dicomFileSpec = dataProvider.DicomSpecs; dicomFileSpec.Should().NotBeNull(); diff --git a/tests/Integration.Test/Common/FhirDataSink.cs b/tests/Integration.Test/Common/FhirDataSink.cs index 1157cfcf2..5db77db96 100644 --- a/tests/Integration.Test/Common/FhirDataSink.cs +++ b/tests/Integration.Test/Common/FhirDataSink.cs @@ -38,7 +38,7 @@ public FhirDataClient(Configurations configurations, InformaticsGatewayConfigura public async Task SendAsync(DataProvider dataProvider, params object[] args) { - Guard.Against.Null(dataProvider); + Guard.Against.Null(dataProvider, nameof(dataProvider)); var httpClient = HttpClientFactory.Create(); httpClient.BaseAddress = new Uri($"{_configurations.InformaticsGatewayOptions.ApiEndpoint}/fhir/"); httpClient.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue(dataProvider.FhirSpecs.MediaType)); diff --git a/tests/Integration.Test/Common/Hl7DataSink.cs b/tests/Integration.Test/Common/Hl7DataSink.cs index 607d960f0..0c340e686 100644 --- a/tests/Integration.Test/Common/Hl7DataSink.cs +++ b/tests/Integration.Test/Common/Hl7DataSink.cs @@ -39,8 +39,8 @@ public Hl7DataClient(Configurations configurations, InformaticsGatewayConfigurat public async Task SendAsync(DataProvider dataProvider, params object[] args) { - Guard.Against.Null(dataProvider); - Guard.Against.NullOrEmpty(args); + Guard.Against.Null(dataProvider, nameof(dataProvider)); + Guard.Against.NullOrEmpty(args, nameof(args)); var batch = (bool)args[0]; diff --git a/tests/Integration.Test/Drivers/EfDataProvider.cs b/tests/Integration.Test/Drivers/EfDataProvider.cs index 2a8be5757..ea0a7202b 100644 --- a/tests/Integration.Test/Drivers/EfDataProvider.cs +++ b/tests/Integration.Test/Drivers/EfDataProvider.cs @@ -48,7 +48,7 @@ public EfDataProvider(ISpecFlowOutputHelper outputHelper, Configurations configu private string ConvertToFullPath(string connectionString) { - Guard.Against.NullOrWhiteSpace(connectionString); + Guard.Against.NullOrWhiteSpace(connectionString, nameof(connectionString)); string absolute = Path.GetFullPath("./"); return connectionString.Replace("=./", $"={absolute}"); diff --git a/tests/Integration.Test/StepDefinitions/DicomDimseScpServicesStepDefinitions.cs b/tests/Integration.Test/StepDefinitions/DicomDimseScpServicesStepDefinitions.cs index 8135888fe..5f2e3a325 100644 --- a/tests/Integration.Test/StepDefinitions/DicomDimseScpServicesStepDefinitions.cs +++ b/tests/Integration.Test/StepDefinitions/DicomDimseScpServicesStepDefinitions.cs @@ -55,7 +55,7 @@ public DicomDimseScpServicesStepDefinitions( [Given(@"a calling AE Title '([^']*)'")] public async Task GivenACallingAETitle(string callingAeTitle) { - Guard.Against.NullOrWhiteSpace(callingAeTitle); + Guard.Against.NullOrWhiteSpace(callingAeTitle, nameof(callingAeTitle)); try { @@ -83,9 +83,9 @@ await _informaticsGatewayClient.DicomSources.Create(new SourceApplicationEntity [Given(@"(.*) (.*) studies with (.*) series per study")] public void GivenXStudiesWithYSeriesPerStudy(int studyCount, string modality, int seriesPerStudy) { - Guard.Against.NegativeOrZero(studyCount); - Guard.Against.NullOrWhiteSpace(modality); - Guard.Against.NegativeOrZero(seriesPerStudy); + Guard.Against.NegativeOrZero(studyCount, nameof(studyCount)); + Guard.Against.NullOrWhiteSpace(modality, nameof(modality)); + Guard.Against.NegativeOrZero(seriesPerStudy, nameof(seriesPerStudy)); _dataProvider.GenerateDicomData(modality, studyCount, seriesPerStudy); @@ -95,9 +95,9 @@ public void GivenXStudiesWithYSeriesPerStudy(int studyCount, string modality, in [Given(@"a called AE Title named '([^']*)' that groups by '([^']*)' for (.*) seconds")] public async Task GivenACalledAETitleNamedThatGroupsByForSeconds(string calledAeTitle, string grouping, uint groupingTimeout) { - Guard.Against.NullOrWhiteSpace(calledAeTitle); - Guard.Against.NullOrWhiteSpace(grouping); - Guard.Against.NegativeOrZero(groupingTimeout); + Guard.Against.NullOrWhiteSpace(calledAeTitle, nameof(calledAeTitle)); + Guard.Against.NullOrWhiteSpace(grouping, nameof(grouping)); + Guard.Against.NegativeOrZero(groupingTimeout, nameof(groupingTimeout)); _dataProvider.StudyGrouping = grouping; try @@ -131,15 +131,15 @@ await _informaticsGatewayClient.MonaiScpAeTitle.Create(new MonaiApplicationEntit [Given(@"a DICOM client configured with (.*) seconds timeout")] public void GivenADICOMClientConfiguredWithSecondsTimeout(int timeout) { - Guard.Against.NegativeOrZero(timeout); + Guard.Against.NegativeOrZero(timeout, nameof(timeout)); _dataProvider.ClientTimeout = timeout; } [Given(@"a DICOM client configured to send data over (.*) associations and wait (.*) between each association")] public void GivenADICOMClientConfiguredToSendDataOverAssociationsAndWaitSecondsBetweenEachAssociation(int associations, int pulseTime) { - Guard.Against.NegativeOrZero(associations); - Guard.Against.Negative(pulseTime); + Guard.Against.NegativeOrZero(associations, nameof(associations)); + Guard.Against.Negative(pulseTime, nameof(associations)); _dataProvider.ClientSendOverAssociations = associations; _dataProvider.ClientAssociationPulseTime = pulseTime; @@ -148,8 +148,8 @@ public void GivenADICOMClientConfiguredToSendDataOverAssociationsAndWaitSecondsB [When(@"a C-ECHO-RQ is sent to '([^']*)' from '([^']*)'")] public async Task WhenAC_ECHO_RQIsSentToFromWithTimeoutOfSeconds(string calledAeTitle, string callingAeTitle) { - Guard.Against.NullOrWhiteSpace(calledAeTitle); - Guard.Against.NullOrWhiteSpace(callingAeTitle); + Guard.Against.NullOrWhiteSpace(calledAeTitle, nameof(calledAeTitle)); + Guard.Against.NullOrWhiteSpace(callingAeTitle, nameof(callingAeTitle)); var echoScu = _objectContainer.Resolve("EchoSCU"); await echoScu.SendAsync( @@ -171,9 +171,9 @@ public void ThenASuccessfulResponseShouldBeReceived() [When(@"C-STORE-RQ are sent to '([^']*)' with AET '([^']*)' from '([^']*)'")] public async Task WhenAC_STORE_RQIsSentToWithAETFromWithTimeoutOfSeconds(string application, string calledAeTitle, string callingAeTitle) { - Guard.Against.NullOrWhiteSpace(application); - Guard.Against.NullOrWhiteSpace(calledAeTitle); - Guard.Against.NullOrWhiteSpace(callingAeTitle); + Guard.Against.NullOrWhiteSpace(application, nameof(application)); + Guard.Against.NullOrWhiteSpace(calledAeTitle, nameof(calledAeTitle)); + Guard.Against.NullOrWhiteSpace(callingAeTitle, nameof(callingAeTitle)); var storeScu = _objectContainer.Resolve("StoreSCU"); diff --git a/tests/Integration.Test/StepDefinitions/DicomWebStowServiceStepDefinitions.cs b/tests/Integration.Test/StepDefinitions/DicomWebStowServiceStepDefinitions.cs index 63df359e7..7edcf6d1f 100644 --- a/tests/Integration.Test/StepDefinitions/DicomWebStowServiceStepDefinitions.cs +++ b/tests/Integration.Test/StepDefinitions/DicomWebStowServiceStepDefinitions.cs @@ -46,8 +46,8 @@ public DicomWebStowServiceStepDefinitions(ObjectContainer objectContainer, Confi [Given(@"(.*) (.*) studies with '(.*)' grouping")] public void GivenNStudies(int studyCount, string modality, string grouping) { - Guard.Against.NegativeOrZero(studyCount); - Guard.Against.NullOrWhiteSpace(modality); + Guard.Against.NegativeOrZero(studyCount, nameof(studyCount)); + Guard.Against.NullOrWhiteSpace(modality, nameof(modality)); _dataProvider.GenerateDicomData(modality, studyCount); _dataProvider.StudyGrouping = grouping; @@ -57,7 +57,7 @@ public void GivenNStudies(int studyCount, string modality, string grouping) [Given(@"a workflow named '(.*)'")] public void GivenNStudies(string workflowName) { - Guard.Against.NullOrWhiteSpace(workflowName); + Guard.Against.NullOrWhiteSpace(workflowName, nameof(workflowName)); _dataProvider.Workflows = new string[] { workflowName }; } @@ -65,7 +65,7 @@ public void GivenNStudies(string workflowName) [When(@"the studies are uploaded to the DICOMWeb STOW-RS service at '([^']*)'")] public async Task WhenStudiesAreUploadedToTheDicomWebStowRSServiceWithoutStudyInstanceUID(string endpoint) { - Guard.Against.NullOrWhiteSpace(endpoint); + Guard.Against.NullOrWhiteSpace(endpoint, nameof(endpoint)); await _dataSink.SendAsync(_dataProvider, $"{_configurations.InformaticsGatewayOptions.ApiEndpoint}{endpoint}", _dataProvider.Workflows, async (DicomWebClient dicomWebClient, DicomDataSpecs specs) => { @@ -77,7 +77,7 @@ await _dataSink.SendAsync(_dataProvider, $"{_configurations.InformaticsGatewayOp [When(@"the studies are uploaded to the DICOMWeb STOW-RS service at '([^']*)' with StudyInstanceUid")] public async Task WhenStudiesAreUploadedToTheDicomWebStowRSServiceWithStudyInstanceUID(string endpoint) { - Guard.Against.NullOrWhiteSpace(endpoint); + Guard.Against.NullOrWhiteSpace(endpoint, nameof(endpoint)); await _dataSink.SendAsync(_dataProvider, $"{_configurations.InformaticsGatewayOptions.ApiEndpoint}{endpoint}", _dataProvider.Workflows, async (DicomWebClient dicomWebClient, DicomDataSpecs specs) => { diff --git a/tests/Integration.Test/StepDefinitions/ExportServicesStepDefinitions.cs b/tests/Integration.Test/StepDefinitions/ExportServicesStepDefinitions.cs index ecdce7b2e..a889c7307 100644 --- a/tests/Integration.Test/StepDefinitions/ExportServicesStepDefinitions.cs +++ b/tests/Integration.Test/StepDefinitions/ExportServicesStepDefinitions.cs @@ -103,8 +103,8 @@ public async Task GivenDICOMInstances() [Given(@"(.*) (.*) studies for export")] public async Task GivenDICOMInstances(int studyCount, string modality) { - Guard.Against.NegativeOrZero(studyCount); - Guard.Against.NullOrWhiteSpace(modality); + Guard.Against.NegativeOrZero(studyCount, nameof(studyCount)); + Guard.Against.NullOrWhiteSpace(modality, nameof(modality)); _dataProvider.GenerateDicomData(modality, studyCount); await _dataSink.SendAsync(_dataProvider); @@ -114,7 +114,7 @@ public async Task GivenDICOMInstances(int studyCount, string modality) [When(@"a export request is sent for '([^']*)'")] public void WhenAExportRequestIsReceivedDesignatedFor(string routingKey) { - Guard.Against.NullOrWhiteSpace(routingKey); + Guard.Against.NullOrWhiteSpace(routingKey, nameof(routingKey)); var exportRequestEvent = new ExportRequestEvent { diff --git a/tests/Integration.Test/StepDefinitions/FhirDefinitions.cs b/tests/Integration.Test/StepDefinitions/FhirDefinitions.cs index 468b6a682..de45b5a69 100644 --- a/tests/Integration.Test/StepDefinitions/FhirDefinitions.cs +++ b/tests/Integration.Test/StepDefinitions/FhirDefinitions.cs @@ -53,8 +53,8 @@ public FhirDefinitions(ObjectContainer objectContainer) [Given(@"FHIR message (.*) in (.*)")] public async Task GivenHl7MessagesInVersionX(string version, string format) { - Guard.Against.NullOrWhiteSpace(version); - Guard.Against.NullOrWhiteSpace(format); + Guard.Against.NullOrWhiteSpace(version, nameof(version)); + Guard.Against.NullOrWhiteSpace(format, nameof(format)); await _dataProvider.GenerateFhirMessages(version, format); _receivedMessages.ClearMessages(); diff --git a/tests/Integration.Test/StepDefinitions/HealthLevel7Definitions.cs b/tests/Integration.Test/StepDefinitions/HealthLevel7Definitions.cs index 62b00d05d..9a8d94399 100644 --- a/tests/Integration.Test/StepDefinitions/HealthLevel7Definitions.cs +++ b/tests/Integration.Test/StepDefinitions/HealthLevel7Definitions.cs @@ -47,7 +47,7 @@ public HealthLevel7Definitions(ObjectContainer objectContainer) [Given(@"HL7 messages in version (.*)")] public async Task GivenHl7MessagesInVersionX(string version) { - Guard.Against.NullOrWhiteSpace(version); + Guard.Against.NullOrWhiteSpace(version, nameof(version)); await _dataProvider.GenerateHl7Messages(version); _receivedMessages.ClearMessages(); } diff --git a/tests/Integration.Test/StepDefinitions/SharedDefinitions.cs b/tests/Integration.Test/StepDefinitions/SharedDefinitions.cs index 47976961b..25be1b7a6 100644 --- a/tests/Integration.Test/StepDefinitions/SharedDefinitions.cs +++ b/tests/Integration.Test/StepDefinitions/SharedDefinitions.cs @@ -49,8 +49,8 @@ public SharedDefinitions(ObjectContainer objectContainer) [Given(@"(.*) (.*) studies")] public void GivenNStudies(int studyCount, string modality) { - Guard.Against.NegativeOrZero(studyCount); - Guard.Against.NullOrWhiteSpace(modality); + Guard.Against.NegativeOrZero(studyCount, nameof(studyCount)); + Guard.Against.NullOrWhiteSpace(modality, nameof(modality)); _dataProvider.GenerateDicomData(modality, studyCount); @@ -60,7 +60,7 @@ public void GivenNStudies(int studyCount, string modality) [Then(@"(.*) workflow requests sent to message broker")] public async Task ThenWorkflowRequestSentToMessageBrokerAsync(int workflowCount) { - Guard.Against.NegativeOrZero(workflowCount); + Guard.Against.NegativeOrZero(workflowCount, nameof(workflowCount)); (await _receivedMessages.WaitforAsync(workflowCount, MessageWaitTimeSpan)).Should().BeTrue(); _assertions.ShouldHaveCorrectNumberOfWorkflowRequestMessages(_dataProvider, _receivedMessages.Messages, workflowCount); diff --git a/tests/Integration.Test/packages.lock.json b/tests/Integration.Test/packages.lock.json index 88627f1f8..1291d26d6 100644 --- a/tests/Integration.Test/packages.lock.json +++ b/tests/Integration.Test/packages.lock.json @@ -229,11 +229,8 @@ }, "Ardalis.GuardClauses": { "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "RemnImQf/BWR8oYqFpdw+hn+b4Q1w+pGujkRiSfjQhMPuiERwGn4UMmQv+6UDE4qbPlnIN+e3e40JkvBhzgfzg==", - "dependencies": { - "JetBrains.Annotations": "2021.3.0" - } + "resolved": "4.1.1", + "contentHash": "+UcJ2s+gf2wMNrwadCaHZV2DMcGgBU1t22A+jm40P4MHQRLy9hcleGy5xdVWd4dXZPa5Vlp4TG5xU2rhoDYrBA==" }, "AspNetCore.HealthChecks.MongoDb": { "type": "Transitive", @@ -317,11 +314,6 @@ "resolved": "19.0.3", "contentHash": "kq9feqMojMj9aABrHb/ABEPaH2Y4dSclseSahAru6qxCeqVQNLLTgw/6vZMauzI1yBUL2fz03ub5yEd5btLfvg==" }, - "JetBrains.Annotations": { - "type": "Transitive", - "resolved": "2021.3.0", - "contentHash": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==" - }, "Karambolo.Extensions.Logging.File": { "type": "Transitive", "resolved": "3.4.0", @@ -1792,7 +1784,7 @@ "monai.deploy.informaticsgateway": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "DotNext.Threading": "[4.7.4, )", "HL7-dotnetcore": "[2.35.0, )", "Karambolo.Extensions.Logging.File": "[3.4.0, )", @@ -1845,14 +1837,14 @@ "monai.deploy.informaticsgateway.client.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.Text.Json": "[6.0.7, )" } }, "monai.deploy.informaticsgateway.common": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "System.IO.Abstractions": "[17.2.3, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )", "fo-dicom": "[5.0.3, )" @@ -1920,7 +1912,7 @@ "monai.deploy.informaticsgateway.dicomweb.client": { "type": "Project", "dependencies": { - "Ardalis.GuardClauses": "[4.0.1, )", + "Ardalis.GuardClauses": "[4.1.1, )", "Microsoft.AspNet.WebApi.Client": "[5.2.9, )", "Microsoft.Extensions.Http": "[6.0.0, )", "Microsoft.Net.Http.Headers": "[2.2.8, )", From ffa41074a2c3a945bd03da0869525518b23cfa6b Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Thu, 3 Aug 2023 11:10:28 -0700 Subject: [PATCH 02/14] Update coverlet.collector Signed-off-by: Victor Chang --- .../Test/Monai.Deploy.InformaticsGateway.Api.Test.csproj | 2 +- src/Api/Test/packages.lock.json | 6 +++--- .../Test/Monai.Deploy.InformaticsGateway.CLI.Test.csproj | 2 +- src/CLI/Test/packages.lock.json | 6 +++--- ...onai.Deploy.InformaticsGateway.Client.Common.Test.csproj | 2 +- src/Client.Common/Test/packages.lock.json | 6 +++--- .../Test/Monai.Deploy.InformaticsGateway.Client.Test.csproj | 2 +- src/Client/Test/packages.lock.json | 6 +++--- .../Test/Monai.Deploy.InformaticsGateway.Common.Test.csproj | 2 +- src/Common/Test/packages.lock.json | 6 +++--- ...onai.Deploy.InformaticsGateway.Configuration.Test.csproj | 2 +- src/Configuration/Test/packages.lock.json | 6 +++--- ...Monai.Deploy.InformaticsGateway.Database.Api.Test.csproj | 2 +- src/Database/Api/Test/packages.lock.json | 6 +++--- ....InformaticsGateway.Database.EntityFramework.Test.csproj | 2 +- src/Database/EntityFramework/Test/packages.lock.json | 6 +++--- ...ormaticsGateway.Database.MongoDB.Integration.Test.csproj | 2 +- src/Database/MongoDB/Integration.Test/packages.lock.json | 6 +++--- ...ai.Deploy.InformaticsGateway.DicomWeb.Client.Test.csproj | 2 +- src/DicomWebClient/Test/packages.lock.json | 6 +++--- .../Test/Monai.Deploy.InformaticsGateway.Test.csproj | 4 ++-- src/InformaticsGateway/Test/packages.lock.json | 6 +++--- 22 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/Api/Test/Monai.Deploy.InformaticsGateway.Api.Test.csproj b/src/Api/Test/Monai.Deploy.InformaticsGateway.Api.Test.csproj index 381c0e4c3..6d53ec127 100644 --- a/src/Api/Test/Monai.Deploy.InformaticsGateway.Api.Test.csproj +++ b/src/Api/Test/Monai.Deploy.InformaticsGateway.Api.Test.csproj @@ -29,7 +29,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Api/Test/packages.lock.json b/src/Api/Test/packages.lock.json index 8fc44c745..e2143559a 100644 --- a/src/Api/Test/packages.lock.json +++ b/src/Api/Test/packages.lock.json @@ -4,9 +4,9 @@ "net6.0": { "coverlet.collector": { "type": "Direct", - "requested": "[3.2.0, )", - "resolved": "3.2.0", - "contentHash": "xjY8xBigSeWIYs4I7DgUHqSNoGqnHi7Fv7/7RZD02rvZyG3hlsjnQKiVKVWKgr9kRKgmV+dEfu8KScvysiC0Wg==" + "requested": "[6.0.0, )", + "resolved": "6.0.0", + "contentHash": "tW3lsNS+dAEII6YGUX/VMoJjBS1QvsxqJeqLaJXub08y1FSjasFPtQ4UBUsudE9PNrzLjooClMsPtY2cZLdXpQ==" }, "Microsoft.NET.Test.Sdk": { "type": "Direct", diff --git a/src/CLI/Test/Monai.Deploy.InformaticsGateway.CLI.Test.csproj b/src/CLI/Test/Monai.Deploy.InformaticsGateway.CLI.Test.csproj index ea5978ae0..07d21f37c 100644 --- a/src/CLI/Test/Monai.Deploy.InformaticsGateway.CLI.Test.csproj +++ b/src/CLI/Test/Monai.Deploy.InformaticsGateway.CLI.Test.csproj @@ -29,7 +29,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/CLI/Test/packages.lock.json b/src/CLI/Test/packages.lock.json index 181a6eca1..2534cbcfc 100644 --- a/src/CLI/Test/packages.lock.json +++ b/src/CLI/Test/packages.lock.json @@ -4,9 +4,9 @@ "net6.0": { "coverlet.collector": { "type": "Direct", - "requested": "[3.2.0, )", - "resolved": "3.2.0", - "contentHash": "xjY8xBigSeWIYs4I7DgUHqSNoGqnHi7Fv7/7RZD02rvZyG3hlsjnQKiVKVWKgr9kRKgmV+dEfu8KScvysiC0Wg==" + "requested": "[6.0.0, )", + "resolved": "6.0.0", + "contentHash": "tW3lsNS+dAEII6YGUX/VMoJjBS1QvsxqJeqLaJXub08y1FSjasFPtQ4UBUsudE9PNrzLjooClMsPtY2cZLdXpQ==" }, "Microsoft.NET.Test.Sdk": { "type": "Direct", diff --git a/src/Client.Common/Test/Monai.Deploy.InformaticsGateway.Client.Common.Test.csproj b/src/Client.Common/Test/Monai.Deploy.InformaticsGateway.Client.Common.Test.csproj index 3c990613d..ac4cbc0cc 100644 --- a/src/Client.Common/Test/Monai.Deploy.InformaticsGateway.Client.Common.Test.csproj +++ b/src/Client.Common/Test/Monai.Deploy.InformaticsGateway.Client.Common.Test.csproj @@ -27,7 +27,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Client.Common/Test/packages.lock.json b/src/Client.Common/Test/packages.lock.json index 043b6e568..c94295e4b 100644 --- a/src/Client.Common/Test/packages.lock.json +++ b/src/Client.Common/Test/packages.lock.json @@ -10,9 +10,9 @@ }, "coverlet.collector": { "type": "Direct", - "requested": "[3.2.0, )", - "resolved": "3.2.0", - "contentHash": "xjY8xBigSeWIYs4I7DgUHqSNoGqnHi7Fv7/7RZD02rvZyG3hlsjnQKiVKVWKgr9kRKgmV+dEfu8KScvysiC0Wg==" + "requested": "[6.0.0, )", + "resolved": "6.0.0", + "contentHash": "tW3lsNS+dAEII6YGUX/VMoJjBS1QvsxqJeqLaJXub08y1FSjasFPtQ4UBUsudE9PNrzLjooClMsPtY2cZLdXpQ==" }, "Microsoft.NET.Test.Sdk": { "type": "Direct", diff --git a/src/Client/Test/Monai.Deploy.InformaticsGateway.Client.Test.csproj b/src/Client/Test/Monai.Deploy.InformaticsGateway.Client.Test.csproj index 604135f06..363e13a2b 100644 --- a/src/Client/Test/Monai.Deploy.InformaticsGateway.Client.Test.csproj +++ b/src/Client/Test/Monai.Deploy.InformaticsGateway.Client.Test.csproj @@ -29,7 +29,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Client/Test/packages.lock.json b/src/Client/Test/packages.lock.json index 28e9456b9..bad0d75f3 100644 --- a/src/Client/Test/packages.lock.json +++ b/src/Client/Test/packages.lock.json @@ -4,9 +4,9 @@ "net6.0": { "coverlet.collector": { "type": "Direct", - "requested": "[3.2.0, )", - "resolved": "3.2.0", - "contentHash": "xjY8xBigSeWIYs4I7DgUHqSNoGqnHi7Fv7/7RZD02rvZyG3hlsjnQKiVKVWKgr9kRKgmV+dEfu8KScvysiC0Wg==" + "requested": "[6.0.0, )", + "resolved": "6.0.0", + "contentHash": "tW3lsNS+dAEII6YGUX/VMoJjBS1QvsxqJeqLaJXub08y1FSjasFPtQ4UBUsudE9PNrzLjooClMsPtY2cZLdXpQ==" }, "Microsoft.NET.Test.Sdk": { "type": "Direct", diff --git a/src/Common/Test/Monai.Deploy.InformaticsGateway.Common.Test.csproj b/src/Common/Test/Monai.Deploy.InformaticsGateway.Common.Test.csproj index 160cb83b9..e3dc89c89 100644 --- a/src/Common/Test/Monai.Deploy.InformaticsGateway.Common.Test.csproj +++ b/src/Common/Test/Monai.Deploy.InformaticsGateway.Common.Test.csproj @@ -25,7 +25,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Common/Test/packages.lock.json b/src/Common/Test/packages.lock.json index 5caca4b78..a35a05792 100644 --- a/src/Common/Test/packages.lock.json +++ b/src/Common/Test/packages.lock.json @@ -4,9 +4,9 @@ "net6.0": { "coverlet.collector": { "type": "Direct", - "requested": "[3.2.0, )", - "resolved": "3.2.0", - "contentHash": "xjY8xBigSeWIYs4I7DgUHqSNoGqnHi7Fv7/7RZD02rvZyG3hlsjnQKiVKVWKgr9kRKgmV+dEfu8KScvysiC0Wg==" + "requested": "[6.0.0, )", + "resolved": "6.0.0", + "contentHash": "tW3lsNS+dAEII6YGUX/VMoJjBS1QvsxqJeqLaJXub08y1FSjasFPtQ4UBUsudE9PNrzLjooClMsPtY2cZLdXpQ==" }, "Microsoft.NET.Test.Sdk": { "type": "Direct", diff --git a/src/Configuration/Test/Monai.Deploy.InformaticsGateway.Configuration.Test.csproj b/src/Configuration/Test/Monai.Deploy.InformaticsGateway.Configuration.Test.csproj index 1c2db96f1..0ab9c12bb 100644 --- a/src/Configuration/Test/Monai.Deploy.InformaticsGateway.Configuration.Test.csproj +++ b/src/Configuration/Test/Monai.Deploy.InformaticsGateway.Configuration.Test.csproj @@ -30,7 +30,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Configuration/Test/packages.lock.json b/src/Configuration/Test/packages.lock.json index da075823f..eac5f2f8b 100644 --- a/src/Configuration/Test/packages.lock.json +++ b/src/Configuration/Test/packages.lock.json @@ -4,9 +4,9 @@ "net6.0": { "coverlet.collector": { "type": "Direct", - "requested": "[3.2.0, )", - "resolved": "3.2.0", - "contentHash": "xjY8xBigSeWIYs4I7DgUHqSNoGqnHi7Fv7/7RZD02rvZyG3hlsjnQKiVKVWKgr9kRKgmV+dEfu8KScvysiC0Wg==" + "requested": "[6.0.0, )", + "resolved": "6.0.0", + "contentHash": "tW3lsNS+dAEII6YGUX/VMoJjBS1QvsxqJeqLaJXub08y1FSjasFPtQ4UBUsudE9PNrzLjooClMsPtY2cZLdXpQ==" }, "Microsoft.NET.Test.Sdk": { "type": "Direct", diff --git a/src/Database/Api/Test/Monai.Deploy.InformaticsGateway.Database.Api.Test.csproj b/src/Database/Api/Test/Monai.Deploy.InformaticsGateway.Database.Api.Test.csproj index 081dad728..04a4cdd78 100644 --- a/src/Database/Api/Test/Monai.Deploy.InformaticsGateway.Database.Api.Test.csproj +++ b/src/Database/Api/Test/Monai.Deploy.InformaticsGateway.Database.Api.Test.csproj @@ -31,7 +31,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/Database/Api/Test/packages.lock.json b/src/Database/Api/Test/packages.lock.json index 2199e7a4b..045d2dd2f 100644 --- a/src/Database/Api/Test/packages.lock.json +++ b/src/Database/Api/Test/packages.lock.json @@ -4,9 +4,9 @@ "net6.0": { "coverlet.collector": { "type": "Direct", - "requested": "[3.2.0, )", - "resolved": "3.2.0", - "contentHash": "xjY8xBigSeWIYs4I7DgUHqSNoGqnHi7Fv7/7RZD02rvZyG3hlsjnQKiVKVWKgr9kRKgmV+dEfu8KScvysiC0Wg==" + "requested": "[6.0.0, )", + "resolved": "6.0.0", + "contentHash": "tW3lsNS+dAEII6YGUX/VMoJjBS1QvsxqJeqLaJXub08y1FSjasFPtQ4UBUsudE9PNrzLjooClMsPtY2cZLdXpQ==" }, "Microsoft.NET.Test.Sdk": { "type": "Direct", diff --git a/src/Database/EntityFramework/Test/Monai.Deploy.InformaticsGateway.Database.EntityFramework.Test.csproj b/src/Database/EntityFramework/Test/Monai.Deploy.InformaticsGateway.Database.EntityFramework.Test.csproj index 4e43d1d33..e9b56c6b3 100644 --- a/src/Database/EntityFramework/Test/Monai.Deploy.InformaticsGateway.Database.EntityFramework.Test.csproj +++ b/src/Database/EntityFramework/Test/Monai.Deploy.InformaticsGateway.Database.EntityFramework.Test.csproj @@ -33,7 +33,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/Database/EntityFramework/Test/packages.lock.json b/src/Database/EntityFramework/Test/packages.lock.json index 8f36d009e..df961fad1 100644 --- a/src/Database/EntityFramework/Test/packages.lock.json +++ b/src/Database/EntityFramework/Test/packages.lock.json @@ -4,9 +4,9 @@ "net6.0": { "coverlet.collector": { "type": "Direct", - "requested": "[3.2.0, )", - "resolved": "3.2.0", - "contentHash": "xjY8xBigSeWIYs4I7DgUHqSNoGqnHi7Fv7/7RZD02rvZyG3hlsjnQKiVKVWKgr9kRKgmV+dEfu8KScvysiC0Wg==" + "requested": "[6.0.0, )", + "resolved": "6.0.0", + "contentHash": "tW3lsNS+dAEII6YGUX/VMoJjBS1QvsxqJeqLaJXub08y1FSjasFPtQ4UBUsudE9PNrzLjooClMsPtY2cZLdXpQ==" }, "Microsoft.EntityFrameworkCore.InMemory": { "type": "Direct", diff --git a/src/Database/MongoDB/Integration.Test/Monai.Deploy.InformaticsGateway.Database.MongoDB.Integration.Test.csproj b/src/Database/MongoDB/Integration.Test/Monai.Deploy.InformaticsGateway.Database.MongoDB.Integration.Test.csproj index 305162131..109394f70 100644 --- a/src/Database/MongoDB/Integration.Test/Monai.Deploy.InformaticsGateway.Database.MongoDB.Integration.Test.csproj +++ b/src/Database/MongoDB/Integration.Test/Monai.Deploy.InformaticsGateway.Database.MongoDB.Integration.Test.csproj @@ -34,7 +34,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/Database/MongoDB/Integration.Test/packages.lock.json b/src/Database/MongoDB/Integration.Test/packages.lock.json index b679a4943..ad7f8cf2c 100644 --- a/src/Database/MongoDB/Integration.Test/packages.lock.json +++ b/src/Database/MongoDB/Integration.Test/packages.lock.json @@ -4,9 +4,9 @@ "net6.0": { "coverlet.collector": { "type": "Direct", - "requested": "[3.2.0, )", - "resolved": "3.2.0", - "contentHash": "xjY8xBigSeWIYs4I7DgUHqSNoGqnHi7Fv7/7RZD02rvZyG3hlsjnQKiVKVWKgr9kRKgmV+dEfu8KScvysiC0Wg==" + "requested": "[6.0.0, )", + "resolved": "6.0.0", + "contentHash": "tW3lsNS+dAEII6YGUX/VMoJjBS1QvsxqJeqLaJXub08y1FSjasFPtQ4UBUsudE9PNrzLjooClMsPtY2cZLdXpQ==" }, "FluentAssertions": { "type": "Direct", diff --git a/src/DicomWebClient/Test/Monai.Deploy.InformaticsGateway.DicomWeb.Client.Test.csproj b/src/DicomWebClient/Test/Monai.Deploy.InformaticsGateway.DicomWeb.Client.Test.csproj index f242df05f..817d9632d 100644 --- a/src/DicomWebClient/Test/Monai.Deploy.InformaticsGateway.DicomWeb.Client.Test.csproj +++ b/src/DicomWebClient/Test/Monai.Deploy.InformaticsGateway.DicomWeb.Client.Test.csproj @@ -27,7 +27,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/DicomWebClient/Test/packages.lock.json b/src/DicomWebClient/Test/packages.lock.json index 4ff60c06a..830d7a2a5 100644 --- a/src/DicomWebClient/Test/packages.lock.json +++ b/src/DicomWebClient/Test/packages.lock.json @@ -10,9 +10,9 @@ }, "coverlet.collector": { "type": "Direct", - "requested": "[3.2.0, )", - "resolved": "3.2.0", - "contentHash": "xjY8xBigSeWIYs4I7DgUHqSNoGqnHi7Fv7/7RZD02rvZyG3hlsjnQKiVKVWKgr9kRKgmV+dEfu8KScvysiC0Wg==" + "requested": "[6.0.0, )", + "resolved": "6.0.0", + "contentHash": "tW3lsNS+dAEII6YGUX/VMoJjBS1QvsxqJeqLaJXub08y1FSjasFPtQ4UBUsudE9PNrzLjooClMsPtY2cZLdXpQ==" }, "Microsoft.NET.Test.Sdk": { "type": "Direct", diff --git a/src/InformaticsGateway/Test/Monai.Deploy.InformaticsGateway.Test.csproj b/src/InformaticsGateway/Test/Monai.Deploy.InformaticsGateway.Test.csproj index 52256569c..2204e5c5a 100644 --- a/src/InformaticsGateway/Test/Monai.Deploy.InformaticsGateway.Test.csproj +++ b/src/InformaticsGateway/Test/Monai.Deploy.InformaticsGateway.Test.csproj @@ -1,4 +1,4 @@ -