diff --git a/src/AzureIoTHub.Portal.Application/Helpers/ConfigHelper.cs b/src/AzureIoTHub.Portal.Application/Helpers/ConfigHelper.cs index d190ddcde..af0490b8e 100644 --- a/src/AzureIoTHub.Portal.Application/Helpers/ConfigHelper.cs +++ b/src/AzureIoTHub.Portal.Application/Helpers/ConfigHelper.cs @@ -148,8 +148,8 @@ public static IoTEdgeModule CreateGatewayModule(Configuration config, JProperty var edgeModule = new IoTEdgeModule { ModuleName = module.Name, - ImageURI = module.Value["settings"]["image"]?.Value(), - ContainerCreateOptions = module.Value["settings"]["createOptions"]?.Value(), + ImageURI = module.Value["settings"]?["image"]?.Value(), + ContainerCreateOptions = module.Value["settings"]?["createOptions"]?.Value(), Status = module.Value["status"]?.Value(), }; @@ -211,7 +211,7 @@ private static Dictionary GetEnvironmentVariables(JProperty modu { foreach (var val in environmentVariables.Cast()) { - envVariables.Add(val.Name, val.Value["value"].Value()); + envVariables.Add(val.Name, val.Value["value"]!.Value()!); } } @@ -251,12 +251,12 @@ public static Dictionary> GenerateModulesCon foreach (var item in edgeModel.SystemModules.Single(x => x.Name == "edgeAgent").EnvironmentVariables) { - edgeAgentPropertiesDesired.SystemModules.EdgeAgent.EnvironmentVariables.Add(item.Name, new EnvironmentVariable() { EnvValue = item.Value }); + edgeAgentPropertiesDesired.SystemModules.EdgeAgent.EnvironmentVariables?.Add(item.Name, new EnvironmentVariable() { EnvValue = item.Value }); } foreach (var item in edgeModel.SystemModules.Single(x => x.Name == "edgeHub").EnvironmentVariables) { - edgeAgentPropertiesDesired.SystemModules.EdgeHub.EnvironmentVariables.Add(item.Name, new EnvironmentVariable() { EnvValue = item.Value }); + edgeAgentPropertiesDesired.SystemModules.EdgeHub.EnvironmentVariables?.Add(item.Name, new EnvironmentVariable() { EnvValue = item.Value }); } var modulesContent = new Dictionary>(); diff --git a/src/AzureIoTHub.Portal.Application/Helpers/DeviceHelper.cs b/src/AzureIoTHub.Portal.Application/Helpers/DeviceHelper.cs index b9cff5c34..2ea7aadd6 100644 --- a/src/AzureIoTHub.Portal.Application/Helpers/DeviceHelper.cs +++ b/src/AzureIoTHub.Portal.Application/Helpers/DeviceHelper.cs @@ -42,7 +42,7 @@ public static string RetrieveSymmetricKey(string deviceId, SymmetricKeyAttestati /// the device twin. /// the tag property. /// The corresponding tag value, or null if it doesn't exist. - public static string RetrieveTagValue(Twin item, string tagName) + public static string? RetrieveTagValue(Twin item, string tagName) { ArgumentNullException.ThrowIfNull(item, nameof(item)); @@ -77,7 +77,7 @@ public static void SetTagValue(Twin item, string tagName, string value) /// Device twin. /// Property to retrieve. /// The corresponding property value, or null if it doesn't exist. - public static string RetrieveDesiredPropertyValue(Twin twin, string propertyName) + public static string? RetrieveDesiredPropertyValue(Twin twin, string propertyName) { ArgumentNullException.ThrowIfNull(twin, nameof(twin)); @@ -91,7 +91,7 @@ public static string RetrieveDesiredPropertyValue(Twin twin, string propertyName /// Device twin. /// Property to set. /// Property value. - public static void SetDesiredProperty(Twin twin, string propertyName, object value) + public static void SetDesiredProperty(Twin twin, string propertyName, object? value) { ArgumentNullException.ThrowIfNull(twin, nameof(twin)); @@ -105,7 +105,7 @@ public static void SetDesiredProperty(Twin twin, string propertyName, object val /// Device twin. /// Property to retrieve. /// Corresponding property value, or null if it doesn't exist. - public static string RetrieveReportedPropertyValue(Twin twin, string propertyName) + public static string? RetrieveReportedPropertyValue(Twin twin, string propertyName) { ArgumentNullException.ThrowIfNull(twin, nameof(twin)); @@ -149,15 +149,15 @@ public static int RetrieveNbModuleCount(Twin twin, string deviceId) /// /// the twin of the device we want. /// string. - public static string RetrieveRuntimeResponse(Twin twin) + public static string? RetrieveRuntimeResponse(Twin twin) { ArgumentNullException.ThrowIfNull(twin, nameof(twin)); var reportedProperties = JObject.Parse(twin.Properties.Reported.ToJson()); if (reportedProperties.TryGetValue("systemModules", out var systemModules) - && systemModules.Value().TryGetValue("edgeAgent", out var edgeAgentModule) - && edgeAgentModule.Value().TryGetValue("runtimeStatus", out var runtimeStatus)) + && systemModules.Value()!.TryGetValue("edgeAgent", out var edgeAgentModule) + && edgeAgentModule.Value()!.TryGetValue("runtimeStatus", out var runtimeStatus)) { return runtimeStatus.Value(); } @@ -182,19 +182,19 @@ public static IReadOnlyCollection RetrieveModuleList(Twin twin) return list; } - foreach (var property in modules.Value()) + foreach (var property in modules.Value()!) { - var propertyObject = property.Value.Value(); + var propertyObject = property.Value?.Value(); var module = new IoTEdgeModule() { ModuleName = property.Key }; - if (propertyObject.TryGetValue("settings", out var moduleSettings)) + if (propertyObject!.TryGetValue("settings", out var moduleSettings)) { var setting = moduleSettings.ToObject>(); - module.ImageURI = setting["image"]; + module.ImageURI = setting?["image"]; } if (propertyObject.TryGetValue("status", out var status)) @@ -247,7 +247,7 @@ public static TwinCollection PropertiesWithDotNotationToTwinCollection(Dictionar return new TwinCollection(JsonConvert.SerializeObject(root)); } - public static string RetrieveClientThumbprintValue(Twin twin) + public static string? RetrieveClientThumbprintValue(Twin twin) { var serializedClientThumbprint = RetrieveDesiredPropertyValue(twin, nameof(Concentrator.ClientThumbprint).ToCamelCase()); @@ -261,13 +261,13 @@ public static string RetrieveClientThumbprintValue(Twin twin) { var clientThumbprintArray=JsonConvert.DeserializeObject(serializedClientThumbprint); - if (clientThumbprintArray.Length == 0) + if (clientThumbprintArray?.Length == 0) { // clientThumbprint array is empty in the device twin return null; } - return clientThumbprintArray[0]; + return clientThumbprintArray?[0]; } catch (JsonReaderException) { diff --git a/src/AzureIoTHub.Portal.Application/Services/IDeviceService.cs b/src/AzureIoTHub.Portal.Application/Services/IDeviceService.cs index 6956a0833..b34735473 100644 --- a/src/AzureIoTHub.Portal.Application/Services/IDeviceService.cs +++ b/src/AzureIoTHub.Portal.Application/Services/IDeviceService.cs @@ -15,15 +15,15 @@ public interface IDeviceService where TDto : IDeviceDetails { Task> GetDevices( - string searchText = null, + string? searchText = null, bool? searchStatus = null, bool? searchState = null, int pageSize = 10, int pageNumber = 0, - string[] orderBy = null, - Dictionary tags = default, - string modelId = null, - List labels = default); + string[]? orderBy = null, + Dictionary? tags = default, + string? modelId = null, + List? labels = default); Task GetDevice(string deviceId); diff --git a/src/AzureIoTHub.Portal.Application/Services/IEdgeDevicesService.cs b/src/AzureIoTHub.Portal.Application/Services/IEdgeDevicesService.cs index 8ed6fd9b1..51785a979 100644 --- a/src/AzureIoTHub.Portal.Application/Services/IEdgeDevicesService.cs +++ b/src/AzureIoTHub.Portal.Application/Services/IEdgeDevicesService.cs @@ -12,13 +12,13 @@ namespace AzureIoTHub.Portal.Application.Services public interface IEdgeDevicesService { Task> GetEdgeDevicesPage( - string searchText = null, + string? searchText = null, bool? searchStatus = null, int pageSize = 10, int pageNumber = 0, - string[] orderBy = null, - string modelId = null, - List labels = default); + string[]? orderBy = null, + string? modelId = null, + List? labels = default); Task GetEdgeDevice(string edgeDeviceId); diff --git a/src/AzureIoTHub.Portal.Application/Services/IExternalDeviceService.cs b/src/AzureIoTHub.Portal.Application/Services/IExternalDeviceService.cs index c781eaae7..9d9a4d57a 100644 --- a/src/AzureIoTHub.Portal.Application/Services/IExternalDeviceService.cs +++ b/src/AzureIoTHub.Portal.Application/Services/IExternalDeviceService.cs @@ -31,20 +31,20 @@ public interface IExternalDeviceService Task DeleteDevice(string deviceId); Task> GetAllDevice( - string continuationToken = null, - string filterDeviceType = null, - string excludeDeviceType = null, - string searchText = null, + string? continuationToken = null, + string? filterDeviceType = null, + string? excludeDeviceType = null, + string? searchText = null, bool? searchStatus = null, bool? searchState = null, - Dictionary searchTags = null, + Dictionary? searchTags = null, int pageSize = 10); Task> GetAllEdgeDevice( - string continuationToken = null, - string searchText = null, + string? continuationToken = null, + string? searchText = null, bool? searchStatus = null, - string searchType = null, + string? searchType = null, int pageSize = 10); Task> GetEdgeDeviceLogs(string deviceId, IoTEdgeModule edgeModule); diff --git a/src/AzureIoTHub.Portal.Application/Services/ILoRaWanManagementService.cs b/src/AzureIoTHub.Portal.Application/Services/ILoRaWanManagementService.cs index ea507a765..77fa44731 100644 --- a/src/AzureIoTHub.Portal.Application/Services/ILoRaWanManagementService.cs +++ b/src/AzureIoTHub.Portal.Application/Services/ILoRaWanManagementService.cs @@ -12,6 +12,6 @@ public interface ILoRaWanManagementService { Task CheckAzureFunctionReturn(CancellationToken cancellationToken); Task ExecuteLoRaDeviceMessage(string deviceId, DeviceModelCommandDto commandDto); - Task GetRouterConfig(string loRaRegion); + Task GetRouterConfig(string loRaRegion); } } diff --git a/src/AzureIoTHub.Portal.Client/App.razor b/src/AzureIoTHub.Portal.Client/App.razor index 87a059950..85bf3c1b7 100644 --- a/src/AzureIoTHub.Portal.Client/App.razor +++ b/src/AzureIoTHub.Portal.Client/App.razor @@ -8,7 +8,7 @@ - @if (!context.User.Identity.IsAuthenticated) + @if (!(context.User.Identity?.IsAuthenticated ?? false)) { } diff --git a/src/AzureIoTHub.Portal.Client/Components/Commons/Labels.razor b/src/AzureIoTHub.Portal.Client/Components/Commons/Labels.razor index f4ddf69d2..c9eb97622 100644 --- a/src/AzureIoTHub.Portal.Client/Components/Commons/Labels.razor +++ b/src/AzureIoTHub.Portal.Client/Components/Commons/Labels.razor @@ -12,16 +12,16 @@ @code { - private IEnumerable displayedLabels; + private IEnumerable displayedLabels = Array.Empty(); [Parameter] public int MaxDisplayedLabels { get; set; } = 3; [Parameter] - public IEnumerable SearchedLabels { get; set; } + public IEnumerable SearchedLabels { get; set; } = Array.Empty(); [Parameter] - public IEnumerable Items { get; set; } + public IEnumerable Items { get; set; } = Array.Empty(); protected override void OnInitialized() { diff --git a/src/AzureIoTHub.Portal.Client/Components/Commons/LabelsEditor.razor b/src/AzureIoTHub.Portal.Client/Components/Commons/LabelsEditor.razor index c2b679deb..4ae627196 100644 --- a/src/AzureIoTHub.Portal.Client/Components/Commons/LabelsEditor.razor +++ b/src/AzureIoTHub.Portal.Client/Components/Commons/LabelsEditor.razor @@ -52,8 +52,8 @@ [Parameter] public List Labels { get; set; } = new(); - private string labelNameValue; - private string labelColorValue; + private string labelNameValue = default!; + private string labelColorValue = default!; public void AddLabel() { diff --git a/src/AzureIoTHub.Portal.Client/Components/Dashboard/DashboardMetricCounter.razor b/src/AzureIoTHub.Portal.Client/Components/Dashboard/DashboardMetricCounter.razor index 3505d28a2..80723013e 100644 --- a/src/AzureIoTHub.Portal.Client/Components/Dashboard/DashboardMetricCounter.razor +++ b/src/AzureIoTHub.Portal.Client/Components/Dashboard/DashboardMetricCounter.razor @@ -8,13 +8,13 @@ @code { [Parameter] - public string Title { get; set; } + public string Title { get; set; } = default!; [Parameter] public int Counter { get; set; } [Parameter] - public string Icon { get; set; } + public string Icon { get; set; } = default!; [Parameter] public Color Color { get; set; } = Color.Inherit; diff --git a/src/AzureIoTHub.Portal.Client/Components/Dashboard/DashboardMetrics.razor b/src/AzureIoTHub.Portal.Client/Components/Dashboard/DashboardMetrics.razor index ab40a6117..103d82e42 100644 --- a/src/AzureIoTHub.Portal.Client/Components/Dashboard/DashboardMetrics.razor +++ b/src/AzureIoTHub.Portal.Client/Components/Dashboard/DashboardMetrics.razor @@ -27,19 +27,19 @@ @code { [CascadingParameter] - public Error Error {get; set;} + public Error Error { get; set; } = default!; private PortalMetric portalMetric = new(); protected override async Task OnInitializedAsync() { - DashboardLayoutService.RefreshDashboardOccurred += DashboardLayoutServiceOnRefreshDashboardOccurred; + DashboardLayoutService.RefreshDashboardOccurred += DashboardLayoutServiceOnRefreshDashboardOccurred!; await LoadMetrics(); } public void Dispose() { - DashboardLayoutService.RefreshDashboardOccurred -= DashboardLayoutServiceOnRefreshDashboardOccurred; + DashboardLayoutService.RefreshDashboardOccurred -= DashboardLayoutServiceOnRefreshDashboardOccurred!; } private async Task LoadMetrics() diff --git a/src/AzureIoTHub.Portal.Client/Components/DeviceModels/LoRaWAN/CreateLoraDeviceModel.razor b/src/AzureIoTHub.Portal.Client/Components/DeviceModels/LoRaWAN/CreateLoraDeviceModel.razor index 43d7f0d81..ba79d4a35 100644 --- a/src/AzureIoTHub.Portal.Client/Components/DeviceModels/LoRaWAN/CreateLoraDeviceModel.razor +++ b/src/AzureIoTHub.Portal.Client/Components/DeviceModels/LoRaWAN/CreateLoraDeviceModel.razor @@ -176,10 +176,10 @@ @code { [Parameter] - public LoRaDeviceModelDto LoRaDeviceModel { get; set; } + public LoRaDeviceModelDto LoRaDeviceModel { get; set; } = default!; [Parameter] - public IList Commands { get; set; } + public IList Commands { get; set; } = new List(); private bool loraProperty { get; set; } @@ -189,7 +189,7 @@ { var last = Commands.LastOrDefault(); - if (Commands.Count == 0 || (last.Name is not null && last.Frame is not null)) + if (Commands.Count == 0 || (last?.Name is not null && last?.Frame is not null)) { Commands.Add(new DeviceModelCommandDto()); } diff --git a/src/AzureIoTHub.Portal.Client/Components/DeviceModels/LoRaWAN/EditLoraDeviceModel.razor b/src/AzureIoTHub.Portal.Client/Components/DeviceModels/LoRaWAN/EditLoraDeviceModel.razor index e623a101e..b64a6f0e3 100644 --- a/src/AzureIoTHub.Portal.Client/Components/DeviceModels/LoRaWAN/EditLoraDeviceModel.razor +++ b/src/AzureIoTHub.Portal.Client/Components/DeviceModels/LoRaWAN/EditLoraDeviceModel.razor @@ -179,10 +179,10 @@ @code { [Parameter] - public LoRaDeviceModelDto LoRaDeviceModel { get; set; } + public LoRaDeviceModelDto LoRaDeviceModel { get; set; } = default!; [Parameter] - public IList Commands { get; set; } + public IList Commands { get; set; } = default!; private DeviceModelCommandDto DeviceModelCommandDto { get; set; } = new DeviceModelCommandDto(); @@ -195,7 +195,7 @@ { var last = Commands.LastOrDefault(); - if (Commands.Count == 0 || (last.Name is not null && last.Frame is not null)) + if (Commands.Count == 0 || (last?.Name is not null && last?.Frame is not null)) { Commands.Add(new DeviceModelCommandDto()); } diff --git a/src/AzureIoTHub.Portal.Client/Components/Devices/DeviceToDuplicateSelector.razor b/src/AzureIoTHub.Portal.Client/Components/Devices/DeviceToDuplicateSelector.razor index 162fe38e1..257e857df 100644 --- a/src/AzureIoTHub.Portal.Client/Components/Devices/DeviceToDuplicateSelector.razor +++ b/src/AzureIoTHub.Portal.Client/Components/Devices/DeviceToDuplicateSelector.razor @@ -40,7 +40,7 @@ @code { [CascadingParameter] - public Error Error {get; set;} + public Error Error { get; set; } = default!; private async Task> SearchDevicesToDuplicate(string query) { diff --git a/src/AzureIoTHub.Portal.Client/Components/Devices/LoRaDeviceTelemetry.razor b/src/AzureIoTHub.Portal.Client/Components/Devices/LoRaDeviceTelemetry.razor index 64b30bd3d..6a2c9f8de 100644 --- a/src/AzureIoTHub.Portal.Client/Components/Devices/LoRaDeviceTelemetry.razor +++ b/src/AzureIoTHub.Portal.Client/Components/Devices/LoRaDeviceTelemetry.razor @@ -16,13 +16,13 @@ @code { [CascadingParameter] - public Error Error { get; set; } + public Error Error { get; set; } = default!; [Parameter] - public string DeviceId { get; set; } + public string DeviceId { get; set; } = default!; private IEnumerable Telemetries = new List(); - private LineConfig chartConfig; + private LineConfig chartConfig = default!; protected override async Task OnAfterRenderAsync(bool firstRender) { diff --git a/src/AzureIoTHub.Portal.Client/Components/Devices/LoRaWAN/CreateLoraDevice.razor b/src/AzureIoTHub.Portal.Client/Components/Devices/LoRaWAN/CreateLoraDevice.razor index 1d085d63d..b5e2ad153 100644 --- a/src/AzureIoTHub.Portal.Client/Components/Devices/LoRaWAN/CreateLoraDevice.razor +++ b/src/AzureIoTHub.Portal.Client/Components/Devices/LoRaWAN/CreateLoraDevice.razor @@ -66,16 +66,16 @@ @code { [CascadingParameter] - public Error Error { get; set; } + public Error Error { get; set; } = default!; [Parameter] - public LoRaDeviceDetails LoRaDevice { get; set; } + public LoRaDeviceDetails LoRaDevice { get; set; } = default!; [Parameter] - public LoRaDeviceDetailsValidator LoraValidator { get; set; } + public LoRaDeviceDetailsValidator LoraValidator { get; set; } = default!; [Parameter] - public LoRaDeviceModelDto LoraModelDto { get; set; } + public LoRaDeviceModelDto LoraModelDto { get; set; } = default!; public List GatewayIdList = new(); @@ -93,6 +93,8 @@ private async Task> SearchGatewayID(string value) { + await Task.Delay(50); + // if text is null or empty, show complete list if (string.IsNullOrEmpty(value)) return GatewayIdList; diff --git a/src/AzureIoTHub.Portal.Client/Components/Devices/LoRaWAN/EditLoraDevice.razor b/src/AzureIoTHub.Portal.Client/Components/Devices/LoRaWAN/EditLoraDevice.razor index 33c65ec8c..fb75858c6 100644 --- a/src/AzureIoTHub.Portal.Client/Components/Devices/LoRaWAN/EditLoraDevice.razor +++ b/src/AzureIoTHub.Portal.Client/Components/Devices/LoRaWAN/EditLoraDevice.razor @@ -170,19 +170,19 @@ @code { [CascadingParameter] - public Error Error { get; set; } + public Error Error { get; set; } = default!; [Parameter] - public LoRaDeviceDetails LoRaDevice { get; set; } + public LoRaDeviceDetails LoRaDevice { get; set; } = default!; [Parameter] - public LoRaDeviceDetailsValidator LoraValidator { get; set; } + public LoRaDeviceDetailsValidator LoraValidator { get; set; } = default!; [Parameter] - public LoRaDeviceModelDto LoRaDeviceModelDto { get; set; } + public LoRaDeviceModelDto LoRaDeviceModelDto { get; set; } = default!; [Parameter] - public IEnumerable Commands { get; set; } + public IEnumerable Commands { get; set; } = Array.Empty(); private bool isProcessing; @@ -202,6 +202,8 @@ private async Task> SearchGatewayID(string value) { + await Task.Delay(50); + // if text is null or empty, show complete list if (string.IsNullOrEmpty(value)) return GatewayIdList; diff --git a/src/AzureIoTHub.Portal.Client/Components/EdgeDevices/EdgeDeviceToDuplicateSelector.razor b/src/AzureIoTHub.Portal.Client/Components/EdgeDevices/EdgeDeviceToDuplicateSelector.razor index b310785f8..5f5c85d94 100644 --- a/src/AzureIoTHub.Portal.Client/Components/EdgeDevices/EdgeDeviceToDuplicateSelector.razor +++ b/src/AzureIoTHub.Portal.Client/Components/EdgeDevices/EdgeDeviceToDuplicateSelector.razor @@ -32,7 +32,7 @@ @code { [CascadingParameter] - public Error Error { get; set; } + public Error Error { get; set; } = default!; private async Task> SearchDevicesToDuplicate(string query) { diff --git a/src/AzureIoTHub.Portal.Client/Components/EdgeModels/EdgeModelSearch.razor b/src/AzureIoTHub.Portal.Client/Components/EdgeModels/EdgeModelSearch.razor index 06f0aaa1c..f6a35e137 100644 --- a/src/AzureIoTHub.Portal.Client/Components/EdgeModels/EdgeModelSearch.razor +++ b/src/AzureIoTHub.Portal.Client/Components/EdgeModels/EdgeModelSearch.razor @@ -18,7 +18,7 @@ [Parameter] public EventCallback OnSearch { get; set; } - private string searchKeyword; + private string searchKeyword = default!; private async Task Search() { diff --git a/src/AzureIoTHub.Portal.Client/Converters/StringToBoolConverter.cs b/src/AzureIoTHub.Portal.Client/Converters/StringToBoolConverter.cs index d9553d8e8..0402e3b8a 100644 --- a/src/AzureIoTHub.Portal.Client/Converters/StringToBoolConverter.cs +++ b/src/AzureIoTHub.Portal.Client/Converters/StringToBoolConverter.cs @@ -14,7 +14,7 @@ public StringToBoolConverter() } #pragma warning disable CA1308 // Normalize strings to uppercase - private string OnGet(bool? value) => value?.ToString()?.ToLowerInvariant(); + private string OnGet(bool? value) => value?.ToString()?.ToLowerInvariant() ?? string.Empty; #pragma warning restore CA1308 // Normalize strings to uppercase private bool? OnSet(string arg) diff --git a/src/AzureIoTHub.Portal.Client/Exceptions/ProblemDetailsException.cs b/src/AzureIoTHub.Portal.Client/Exceptions/ProblemDetailsException.cs index 4743d7522..53da129fd 100644 --- a/src/AzureIoTHub.Portal.Client/Exceptions/ProblemDetailsException.cs +++ b/src/AzureIoTHub.Portal.Client/Exceptions/ProblemDetailsException.cs @@ -8,9 +8,9 @@ namespace AzureIoTHub.Portal.Client.Exceptions public class ProblemDetailsException : Exception { - public ProblemDetailsException(ProblemDetailsWithExceptionDetails problemDetailsWithExceptionDetails) + public ProblemDetailsException(ProblemDetailsWithExceptionDetails? problemDetailsWithExceptionDetails) { - ProblemDetailsWithExceptionDetails = problemDetailsWithExceptionDetails; + ProblemDetailsWithExceptionDetails = problemDetailsWithExceptionDetails ?? new ProblemDetailsWithExceptionDetails(); } public ProblemDetailsWithExceptionDetails ProblemDetailsWithExceptionDetails { get; } diff --git a/src/AzureIoTHub.Portal.Client/Handlers/ProblemDetailsHandler.cs b/src/AzureIoTHub.Portal.Client/Handlers/ProblemDetailsHandler.cs index 33054ad57..bc3681af5 100644 --- a/src/AzureIoTHub.Portal.Client/Handlers/ProblemDetailsHandler.cs +++ b/src/AzureIoTHub.Portal.Client/Handlers/ProblemDetailsHandler.cs @@ -21,6 +21,7 @@ protected override async Task SendAsync(HttpRequestMessage } var problemDetails = await response.Content.ReadFromJsonAsync(cancellationToken: cancellationToken); + throw new ProblemDetailsException(problemDetails); } } diff --git a/src/AzureIoTHub.Portal.Client/Models/ProblemDetailsWithExceptionDetails.cs b/src/AzureIoTHub.Portal.Client/Models/ProblemDetailsWithExceptionDetails.cs index cfe534e79..967f9141d 100644 --- a/src/AzureIoTHub.Portal.Client/Models/ProblemDetailsWithExceptionDetails.cs +++ b/src/AzureIoTHub.Portal.Client/Models/ProblemDetailsWithExceptionDetails.cs @@ -7,28 +7,28 @@ namespace AzureIoTHub.Portal.Client.Models public class ProblemDetailsWithExceptionDetails : Microsoft.AspNetCore.Mvc.ProblemDetails { - public string TraceId { get; set; } + public string TraceId { get; set; } = default!; - public List ExceptionDetails { get; set; } + public List ExceptionDetails { get; set; } = new(); public class ExceptionDetail { - public string Message { get; set; } - public string Type { get; set; } - public string Raw { get; set; } - public List StackFrames { get; set; } + public string Message { get; set; } = default!; + public string Type { get; set; } = default!; + public string Raw { get; set; } = default!; + public List StackFrames { get; set; } = new(); } public class StackFrame { - public string FilePath { get; set; } - public string FileName { get; set; } - public string Function { get; set; } + public string FilePath { get; set; } = default!; + public string FileName { get; set; } = default!; + public string Function { get; set; } = default!; public int? Line { get; set; } public int? PreContextLine { get; set; } - public List PreContextCode { get; set; } - public List ContextCode { get; set; } - public List PostContextCode { get; set; } + public List PreContextCode { get; set; } = new(); + public List ContextCode { get; set; } = new(); + public List PostContextCode { get; set; } = new(); } } } diff --git a/src/AzureIoTHub.Portal.Client/Pages/Authentication.razor b/src/AzureIoTHub.Portal.Client/Pages/Authentication.razor index 22520e1cf..71593f6b4 100644 --- a/src/AzureIoTHub.Portal.Client/Pages/Authentication.razor +++ b/src/AzureIoTHub.Portal.Client/Pages/Authentication.razor @@ -29,7 +29,7 @@ @code { - [Parameter] public string Action { get; set; } + [Parameter] public string Action { get; set; } = default!; protected override Task OnInitializedAsync() { diff --git a/src/AzureIoTHub.Portal.Client/Pages/Dashboard/Dashboard.razor b/src/AzureIoTHub.Portal.Client/Pages/Dashboard/Dashboard.razor index 484cdbbca..a793ba1b4 100644 --- a/src/AzureIoTHub.Portal.Client/Pages/Dashboard/Dashboard.razor +++ b/src/AzureIoTHub.Portal.Client/Pages/Dashboard/Dashboard.razor @@ -4,7 +4,7 @@ Dashboard - + diff --git a/src/AzureIoTHub.Portal.Client/Pages/DeviceConfigurations/CreateDeviceConfigurationsPage.razor b/src/AzureIoTHub.Portal.Client/Pages/DeviceConfigurations/CreateDeviceConfigurationsPage.razor index e131fa1cf..656b705ca 100644 --- a/src/AzureIoTHub.Portal.Client/Pages/DeviceConfigurations/CreateDeviceConfigurationsPage.razor +++ b/src/AzureIoTHub.Portal.Client/Pages/DeviceConfigurations/CreateDeviceConfigurationsPage.razor @@ -90,7 +90,7 @@ Color="Color.Primary" Disabled="string.IsNullOrEmpty(SelectedTag)" OnClick="AddSelectedTag" - StartIcon="@Icons.Filled.Add" id="addTagButton">Add Tag + StartIcon="@Icons.Material.Filled.Add" id="addTagButton">Add Tag @@ -148,7 +148,7 @@ Color="Color.Primary" Disabled="string.IsNullOrEmpty(SelectedProperty)" OnClick="AddSelectedProperty" - StartIcon="@Icons.Filled.Add" id="addPropertyButton">Add Property + StartIcon="@Icons.Material.Filled.Add" id="addPropertyButton">Add Property @@ -224,7 +224,7 @@ @code { [CascadingParameter] - public Error Error {get; set;} + public Error Error { get; set; } = default!; public DeviceConfig Configuration { get; set; } = new(); @@ -232,8 +232,8 @@ IEnumerable AvailableProperties = Array.Empty(); IEnumerable AvailableModels = Array.Empty(); - public string SelectedTag { get; set; } - public string SelectedProperty { get; set; } + public string SelectedTag { get; set; } = default!; + public string SelectedProperty { get; set; } = default!; private bool isProcessing; diff --git a/src/AzureIoTHub.Portal.Client/Pages/DeviceConfigurations/DeleteDeviceConfiguration.razor b/src/AzureIoTHub.Portal.Client/Pages/DeviceConfigurations/DeleteDeviceConfiguration.razor index 24fe66796..80a08c18c 100644 --- a/src/AzureIoTHub.Portal.Client/Pages/DeviceConfigurations/DeleteDeviceConfiguration.razor +++ b/src/AzureIoTHub.Portal.Client/Pages/DeviceConfigurations/DeleteDeviceConfiguration.razor @@ -22,11 +22,11 @@ @code { [CascadingParameter] - public Error Error {get; set;} - - [CascadingParameter] MudDialogInstance MudDialog { get; set; } - [Parameter] public string configurationName { get; set; } - [Parameter] public string configurationId { get; set; } + public Error Error { get; set; } = default!; + + [CascadingParameter] MudDialogInstance MudDialog { get; set; } = default!; + [Parameter] public string configurationName { get; set; } = default!; + [Parameter] public string configurationId { get; set; } = default!; void Cancel() => MudDialog.Cancel(); diff --git a/src/AzureIoTHub.Portal.Client/Pages/DeviceConfigurations/DeviceConfigurationDetailPage.razor b/src/AzureIoTHub.Portal.Client/Pages/DeviceConfigurations/DeviceConfigurationDetailPage.razor index a5cd356cd..cfcad67c2 100644 --- a/src/AzureIoTHub.Portal.Client/Pages/DeviceConfigurations/DeviceConfigurationDetailPage.razor +++ b/src/AzureIoTHub.Portal.Client/Pages/DeviceConfigurations/DeviceConfigurationDetailPage.razor @@ -12,7 +12,7 @@ @inject IDeviceTagSettingsClientService DeviceTagSettingsClientService - + Device Configuration Details @@ -86,7 +86,7 @@ Color="Color.Primary" Disabled="string.IsNullOrEmpty(SelectedTag)" OnClick="AddSelectedTag" - StartIcon="@Icons.Filled.Add" id="addTagButton">Add Tag + StartIcon="@Icons.Material.Filled.Add" id="addTagButton">Add Tag @@ -143,7 +143,7 @@ Color="Color.Primary" Disabled="string.IsNullOrEmpty(SelectedProperty)" OnClick="AddSelectedProperty" - StartIcon="@Icons.Filled.Add" id="addPropertyButton">Add Property + StartIcon="@Icons.Material.Filled.Add" id="addPropertyButton">Add Property @@ -219,16 +219,16 @@ @code { [CascadingParameter] - public Error Error {get; set;} + public Error Error { get; set; } = default!; IEnumerable AvailableTags { get; set; } = Array.Empty(); IEnumerable AvailableProperties = Array.Empty(); - public string SelectedTag { get; set; } - public string SelectedProperty { get; set; } + public string SelectedTag { get; set; } = default!; + public string SelectedProperty { get; set; } = default!; [Parameter] - public string ConfigId { get; set; } + public string ConfigId { get; set; } = default!; public DeviceConfig Configuration { get; set; } = new(); public DeviceModelDto DeviceModel { get; set; } = new(); @@ -286,7 +286,7 @@ isProcessing = false; - if (confirm.Cancelled) + if (confirm.Canceled) { return; } diff --git a/src/AzureIoTHub.Portal.Client/Pages/DeviceConfigurations/DeviceConfigurationListPage.razor b/src/AzureIoTHub.Portal.Client/Pages/DeviceConfigurations/DeviceConfigurationListPage.razor index 4edc7ea7a..79c1f9819 100644 --- a/src/AzureIoTHub.Portal.Client/Pages/DeviceConfigurations/DeviceConfigurationListPage.razor +++ b/src/AzureIoTHub.Portal.Client/Pages/DeviceConfigurations/DeviceConfigurationListPage.razor @@ -21,7 +21,7 @@ Device configurations - + ID @@ -50,7 +50,7 @@ @context.Priority @context.CreationDate - + @@ -68,7 +68,7 @@ @code { [CascadingParameter] - public Error Error {get; set;} + public Error Error { get; set; } = default!; private readonly List result = new(); private bool IsLoading { get; set; } = true; diff --git a/src/AzureIoTHub.Portal.Client/Pages/DeviceModels/CreateDeviceModelPage.razor b/src/AzureIoTHub.Portal.Client/Pages/DeviceModels/CreateDeviceModelPage.razor index 21caaf8a7..ca55dead3 100644 --- a/src/AzureIoTHub.Portal.Client/Pages/DeviceModels/CreateDeviceModelPage.razor +++ b/src/AzureIoTHub.Portal.Client/Pages/DeviceModels/CreateDeviceModelPage.razor @@ -33,7 +33,7 @@ else {