diff --git a/src/Diagnostics.DataProviders/DataProviders/KustoDataProvider.cs b/src/Diagnostics.DataProviders/DataProviders/KustoDataProvider.cs
index 65e970bf7..7ff966631 100644
--- a/src/Diagnostics.DataProviders/DataProviders/KustoDataProvider.cs
+++ b/src/Diagnostics.DataProviders/DataProviders/KustoDataProvider.cs
@@ -14,10 +14,10 @@ namespace Diagnostics.DataProviders
{
public class KustoQuery
{
- public string Text { get; set; }
- public string Url { get; set; }
- public string KustoDesktopUrl { get; set; }
- public string OperationName { get; set; }
+ public string Text;
+ public string Url;
+ public string KustoDesktopUrl;
+ public string OperationName;
}
public class KustoDataProvider : DiagnosticDataProvider, IKustoDataProvider
diff --git a/src/Diagnostics.DataProviders/HealthCheckResult.cs b/src/Diagnostics.DataProviders/HealthCheckResult.cs
index 20ce04606..4ca59a049 100644
--- a/src/Diagnostics.DataProviders/HealthCheckResult.cs
+++ b/src/Diagnostics.DataProviders/HealthCheckResult.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
-using System.Text.Json.Serialization;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
namespace Diagnostics.DataProviders
{
@@ -14,7 +15,7 @@ public enum HealthStatus
///
public sealed class HealthCheckResult
{
- [JsonConverter(typeof(JsonStringEnumConverter))]
+ [JsonConverter(typeof(StringEnumConverter))]
public HealthStatus Status { get; private set; }
public string Name { get; private set; }
public string Description { get; private set; }
diff --git a/src/Diagnostics.DataProviders/KustoSDKClient.cs b/src/Diagnostics.DataProviders/KustoSDKClient.cs
index 138d1b6d8..70f38f467 100644
--- a/src/Diagnostics.DataProviders/KustoSDKClient.cs
+++ b/src/Diagnostics.DataProviders/KustoSDKClient.cs
@@ -308,9 +308,9 @@ private void LogKustoQuery(string query, string cluster, string operationName, S
if (dataSet != null && dataSet.Tables != null && dataSet.Tables.Count >= 4)
{
var statisticsTable = dataSet.Tables[dataSet.Tables.Count - 2].ToDataTableResponseObject();
- if (statisticsTable.Rows.Length >= 2 && statisticsTable.Rows[1].Length >= 5)
+ if (statisticsTable.Rows.GetLength(0) >= 2 && statisticsTable.Rows.GetLength(1) >= 5)
{
- stats = statisticsTable.Rows[1][4];
+ stats = statisticsTable.Rows[1, 4];
}
}
diff --git a/src/Diagnostics.ModelsAndUtils/Attributes/Definition.cs b/src/Diagnostics.ModelsAndUtils/Attributes/Definition.cs
index 910bd19bc..ab7c753d4 100644
--- a/src/Diagnostics.ModelsAndUtils/Attributes/Definition.cs
+++ b/src/Diagnostics.ModelsAndUtils/Attributes/Definition.cs
@@ -2,13 +2,12 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
//
-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
-using System.Text.Json.Serialization;
using Diagnostics.ModelsAndUtils.Models;
+using Newtonsoft.Json;
namespace Diagnostics.ModelsAndUtils.Attributes
{
@@ -57,38 +56,17 @@ public Definition()
///
/// List of Support Topics for which this detector is enabled.
- /// Mark it as JsonIgnore because the SupportTopic class is deriving
- /// from Attribute and attributes are not serialized by System.Text.Json
- ///
- [JsonIgnore]
- public IEnumerable SupportTopicList { get; set; }
-
- ///
- /// Property created only for Json Serialization as Attributes
- /// are not serialized today properly by System.Text.Json
- /// https://github.com/dotnet/runtime/issues/58947
///
[DataMember]
- [JsonPropertyName("supportTopicList")]
- public IEnumerable SupportTopicListSTJCompat
- {
- get
- {
- if (SupportTopicList == null)
- {
- return null;
- }
-
- return SupportTopicList
- .Where(st => st != null)
- .Select(x => new SupportTopicSTJCompat(x));
- }
- }
+ public IEnumerable SupportTopicList { get; set; }
+ [JsonIgnore]
public string AnalysisType { get; set; } = string.Empty;
+ [JsonIgnore]
private Guid instanceGUID;
+ [JsonIgnore]
public override object TypeId { get { return (object)instanceGUID; } }
///
diff --git a/src/Diagnostics.ModelsAndUtils/Attributes/SupportTopic.cs b/src/Diagnostics.ModelsAndUtils/Attributes/SupportTopic.cs
index e70f84697..633fd1c4e 100644
--- a/src/Diagnostics.ModelsAndUtils/Attributes/SupportTopic.cs
+++ b/src/Diagnostics.ModelsAndUtils/Attributes/SupportTopic.cs
@@ -24,34 +24,4 @@ public bool Equals(SupportTopic other)
return (this.Id == other.Id && this.PesId == other.PesId);
}
}
-
- ///
- /// Class created just for Json Serialization as Attributes
- /// are not serialized properly to Json using System.Text.Json
- /// https://github.com/dotnet/runtime/issues/58947
- ///
- public class SupportTopicSTJCompat
- {
- ///
- /// Support Topic Id
- ///
- /// See
- public string Id { get; set; }
-
- ///
- /// Unique resource Id.
- ///
- public string PesId { get; set; }
-
- public SupportTopicSTJCompat(SupportTopic st)
- {
- if (st == null)
- {
- throw new ArgumentNullException(nameof(st));
- }
-
- this.Id = st.Id;
- this.PesId = st.Id;
- }
- }
}
diff --git a/src/Diagnostics.ModelsAndUtils/Models/DataProviderMetadata.cs b/src/Diagnostics.ModelsAndUtils/Models/DataProviderMetadata.cs
index 882cc7b36..81f7fee85 100644
--- a/src/Diagnostics.ModelsAndUtils/Models/DataProviderMetadata.cs
+++ b/src/Diagnostics.ModelsAndUtils/Models/DataProviderMetadata.cs
@@ -4,7 +4,7 @@ namespace Diagnostics.ModelsAndUtils.Models
{
public class DataProviderMetadata
{
- public string ProviderName { get; set; }
+ public string ProviderName;
public List> PropertyBag { get; }
public DataProviderMetadata()
diff --git a/src/Diagnostics.ModelsAndUtils/Models/DataTableResponseObject.cs b/src/Diagnostics.ModelsAndUtils/Models/DataTableResponseObject.cs
index 1c142324c..ff10ddda5 100644
--- a/src/Diagnostics.ModelsAndUtils/Models/DataTableResponseObject.cs
+++ b/src/Diagnostics.ModelsAndUtils/Models/DataTableResponseObject.cs
@@ -22,7 +22,7 @@ public class DataTableResponseObject
public IEnumerable Columns { get; set; }
- public dynamic[][] Rows { get; set; }
+ public dynamic[,] Rows { get; set; }
}
public class DataTableResponseColumn
@@ -41,7 +41,7 @@ public class AppInsightsDataTableResponseObject
{
public string Name { get; set; }
public IEnumerable Columns { get; set; }
- public dynamic[][] Rows { get; set; }
+ public dynamic[,] Rows { get; set; }
}
public class AppInsightsDataTableResponseColumn
@@ -68,7 +68,7 @@ public static DataTable ToDataTable(this DataTableResponseObject dataTableRespon
var row = dataTable.NewRow();
for (int j = 0; j < dataTable.Columns.Count; j++)
{
- row[j] = dataTableResponse.Rows[i][j] ?? DBNull.Value;
+ row[j] = dataTableResponse.Rows[i, j] ?? DBNull.Value;
}
dataTable.Rows.Add(row);
@@ -92,7 +92,7 @@ public static DataTable ToAppInsightsDataTable(this AppInsightsDataTableResponse
var row = dataTable.NewRow();
for (int j = 0; j < dataTable.Columns.Count; j++)
{
- row[j] = MaskPII(appInsightsDataTableResponse.Rows[i][j]) ?? DBNull.Value;
+ row[j] = MaskPII(appInsightsDataTableResponse.Rows[i, j]) ?? DBNull.Value;
}
dataTable.Rows.Add(row);
@@ -125,11 +125,14 @@ public static DataTableResponseObject ToDataTableResponseObject(this DataTable t
columns.Add(new DataTableResponseColumn() { ColumnName = col.ColumnName, DataType = col.DataType.ToString().Replace("System.", "") });
}
- var rows = new dynamic[table.Rows.Count][];
+ var rows = new dynamic[table.Rows.Count, table.Columns.Count];
for (int i = 0; i < table.Rows.Count; i++)
{
- rows[i] = table.Rows[i].ItemArray;
+ for (int j = 0; j < table.Columns.Count; j++)
+ {
+ rows[i, j] = table.Rows[i][j] == DBNull.Value ? null : table.Rows[i][j];
+ }
}
dataTableResponseObject.Columns = columns;
diff --git a/src/Diagnostics.ModelsAndUtils/Models/DetectorType.cs b/src/Diagnostics.ModelsAndUtils/Models/DetectorType.cs
index 02f523135..501116cfc 100644
--- a/src/Diagnostics.ModelsAndUtils/Models/DetectorType.cs
+++ b/src/Diagnostics.ModelsAndUtils/Models/DetectorType.cs
@@ -3,15 +3,15 @@
// Licensed under the MIT License. See LICENSE in the project root for license information.
//
-
-using System.Text.Json.Serialization;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
namespace Diagnostics.ModelsAndUtils.Models
{
///
/// Defines whether the Detector is of type Analysis or not.
///
- [JsonConverter(typeof(JsonStringEnumConverter))]
+ [JsonConverter(typeof(StringEnumConverter))]
public enum DetectorType
{
///
diff --git a/src/Diagnostics.ModelsAndUtils/Models/Response.cs b/src/Diagnostics.ModelsAndUtils/Models/Response.cs
index 27efa8137..232fb97e5 100644
--- a/src/Diagnostics.ModelsAndUtils/Models/Response.cs
+++ b/src/Diagnostics.ModelsAndUtils/Models/Response.cs
@@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.Data;
using System.Linq;
-using System.Text.Json.Serialization;
using Diagnostics.ModelsAndUtils.Attributes;
using Diagnostics.ModelsAndUtils.Models.ResponseExtensions;
diff --git a/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/Card.cs b/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/Card.cs
index 359c00968..5424c0731 100644
--- a/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/Card.cs
+++ b/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/Card.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Data;
-using System.Text.Json;
-using System.Text.Json.Serialization;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
namespace Diagnostics.ModelsAndUtils.Models.ResponseExtensions
{
@@ -16,12 +16,12 @@ public class Card
///
/// Title of the Card
///
- public string Title { get; set; }
+ public string Title;
///
/// A list of descriptions for this card
///
- public List Descriptions { get; set; }
+ public List Descriptions;
///
/// Specify and icon from the font-awesome collection (for e.g. fa-circle)
@@ -31,13 +31,13 @@ public class Card
///
/// Specify the action type for this card
///
- [JsonConverter(typeof(JsonStringEnumConverter))]
- public CardActionType ActionType { get; set; }
+ [JsonConverter(typeof(StringEnumConverter))]
+ public CardActionType ActionType;
///
/// Specify the action value for the card (will be detectorId for detectors)
///
- public string ActionValue { get; set; }
+ public string ActionValue;
///
/// Creates an instance of Card class.
@@ -105,8 +105,8 @@ public static DiagnosticData AddCards(this Response response, List cards)
table.Rows.Add(new object[] {
card.Title,
card.Icon,
- JsonSerializer.Serialize(card.Descriptions),
- JsonSerializer.Serialize(card.ActionType),
+ JsonConvert.SerializeObject(card.Descriptions),
+ JsonConvert.SerializeObject(card.ActionType),
card.ActionValue
});
});
diff --git a/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/Downtime.cs b/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/Downtime.cs
index a53b30885..fdf167081 100644
--- a/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/Downtime.cs
+++ b/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/Downtime.cs
@@ -10,12 +10,12 @@ public class DownTime
///
/// Represents the start time for the downtime period
///
- public DateTime StartTime { get; set; } = DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc);
+ public DateTime StartTime { get; set; } = DateTime.MinValue;
///
/// The end time for the downtime period
///
- public DateTime EndTime { get; set; } = DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc);
+ public DateTime EndTime { get; set; } = DateTime.MinValue;
///
/// A optional label that if specified can be used to render a label or span in downtime analysis
diff --git a/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/Guage.cs b/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/Guage.cs
index ce3408787..dd110833a 100644
--- a/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/Guage.cs
+++ b/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/Guage.cs
@@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.Data;
using System.Linq;
-using System.Text.Json;
-using System.Text.Json.Serialization;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
namespace Diagnostics.ModelsAndUtils.Models.ResponseExtensions
{
@@ -25,7 +25,7 @@ public Guage(InsightStatus status, double percentFilled, string displayValue, st
///
/// Insight Level for the Guage. Decides the color of the Guage. Red for Critical, Orange for Warning, Green for Success and Blue for Info & None.
///
- [JsonConverter(typeof(JsonStringEnumConverter))]
+ [JsonConverter(typeof(StringEnumConverter))]
public InsightStatus Status { get; set; }
private double _percentFilled;
@@ -61,7 +61,7 @@ public double PercentFilled
///
/// Size of the Guage. Can be either Small, Medium or Large
///
- [JsonConverter(typeof(JsonStringEnumConverter))]
+ [JsonConverter(typeof(StringEnumConverter))]
public GuageSize Size { get; set; }
///
@@ -159,8 +159,8 @@ public static DiagnosticData AddGuages(this Response response, List guage
foreach (Guage g in guages)
{
table.Rows.Add(
- JsonSerializer.Serialize(renderDirection),
- JsonSerializer.Serialize(g.Size),
+ JsonConvert.SerializeObject(renderDirection),
+ JsonConvert.SerializeObject(g.Size),
g.Status,
g.PercentFilled,
g.DisplayValue,
diff --git a/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/Solution.cs b/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/Solution.cs
index 8aabde52e..3669d66c6 100644
--- a/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/Solution.cs
+++ b/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/Solution.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
-using System.Text.Json.Serialization;
using Diagnostics.ModelsAndUtils.ScriptUtilities;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
namespace Diagnostics.ModelsAndUtils.Models.ResponseExtensions
{
@@ -24,7 +25,7 @@ public class Solution
///
/// Denotes which action will be performed, such as calling an ARM API or navigating to a Portal Blade.
///
- [JsonConverter(typeof(JsonStringEnumConverter))]
+ [JsonConverter(typeof(StringEnumConverter))]
public ActionType Action { get; set; }
///
@@ -121,10 +122,10 @@ public class SolutionButtonOption
{
public string Label { get; set; }
- [JsonConverter(typeof(JsonStringEnumConverter))]
+ [JsonConverter(typeof(StringEnumConverter))]
public SolutionButtonType Type { get; set; } = SolutionButtonType.Button;
- [JsonConverter(typeof(JsonStringEnumConverter))]
+ [JsonConverter(typeof(StringEnumConverter))]
public SolutionButtonPosition Position { get; set; } = SolutionButtonPosition.Bottom;
public SolutionButtonOption(string label, SolutionButtonType type = SolutionButtonType.Button, SolutionButtonPosition position = SolutionButtonPosition.Bottom)
diff --git a/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/SummaryCard.cs b/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/SummaryCard.cs
index 0322224a3..a011dbd24 100644
--- a/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/SummaryCard.cs
+++ b/src/Diagnostics.ModelsAndUtils/Models/ResponseExtensions/SummaryCard.cs
@@ -2,7 +2,8 @@
using System.Collections.Generic;
using System.Data;
using System.Linq;
-using System.Text.Json.Serialization;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
namespace Diagnostics.ModelsAndUtils.Models.ResponseExtensions
{
@@ -43,7 +44,7 @@ public class SummaryCard
///
/// Spicfy the status(Critical,Warning,Info,Success,None) shown as icon in middle left card
///
- [JsonConverter(typeof(JsonStringEnumConverter))]
+ [JsonConverter(typeof(StringEnumConverter))]
public SummaryCardStatus Status { set; get; }
///
@@ -54,7 +55,7 @@ public class SummaryCard
///
/// Spicfy the Action Type(Detector,Tool)
///
- [JsonConverter(typeof(JsonStringEnumConverter))]
+ [JsonConverter(typeof(StringEnumConverter))]
public SummaryCardActionType OnClickActionType { set; get; }
///
diff --git a/src/Diagnostics.RuntimeHost/Diagnostics.RuntimeHost.csproj b/src/Diagnostics.RuntimeHost/Diagnostics.RuntimeHost.csproj
index 7a60dec93..ba3db58be 100644
--- a/src/Diagnostics.RuntimeHost/Diagnostics.RuntimeHost.csproj
+++ b/src/Diagnostics.RuntimeHost/Diagnostics.RuntimeHost.csproj
@@ -27,7 +27,6 @@
-
diff --git a/src/Diagnostics.RuntimeHost/Services/CacheService/DiagEntityTableCacheService.cs b/src/Diagnostics.RuntimeHost/Services/CacheService/DiagEntityTableCacheService.cs
index 7f526b3f9..7eb6ae776 100644
--- a/src/Diagnostics.RuntimeHost/Services/CacheService/DiagEntityTableCacheService.cs
+++ b/src/Diagnostics.RuntimeHost/Services/CacheService/DiagEntityTableCacheService.cs
@@ -42,8 +42,8 @@ private async void StartPolling()
DiagnosticsETWProvider.Instance.LogAzureStorageMessage(nameof(DiagEntityTableCacheService), "Start polling Azure Storage for refreshing cache");
try
{
- var detectorTask = storageService.GetEntitiesByPartitionkey("Detector", startUp ? DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc) : DateTime.UtcNow.AddMinutes(-5));
- var gistTask = storageService.GetEntitiesByPartitionkey("Gist", startUp ? DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc) : DateTime.UtcNow.AddMinutes(-5));
+ var detectorTask = storageService.GetEntitiesByPartitionkey("Detector", startUp ? DateTime.MinValue : DateTime.UtcNow.AddMinutes(-5));
+ var gistTask = storageService.GetEntitiesByPartitionkey("Gist", startUp ? DateTime.MinValue : DateTime.UtcNow.AddMinutes(-5));
await Task.WhenAll(new Task[] { detectorTask, gistTask });
var detectorResult = await detectorTask;
if (startUp)
diff --git a/src/Diagnostics.RuntimeHost/Services/SourceWatcher/Watchers/StorageWatcher.cs b/src/Diagnostics.RuntimeHost/Services/SourceWatcher/Watchers/StorageWatcher.cs
index fed770421..c0d84f06d 100644
--- a/src/Diagnostics.RuntimeHost/Services/SourceWatcher/Watchers/StorageWatcher.cs
+++ b/src/Diagnostics.RuntimeHost/Services/SourceWatcher/Watchers/StorageWatcher.cs
@@ -206,12 +206,12 @@ private async Task StartBlobDownload(bool startup = false)
var timeRange = DateTime.UtcNow.AddMinutes(-5);
if(!diagEntityTableCacheService.TryGetValue("Detector", out List detectorsList) || detectorsList == null || detectorsList.Count < 1)
{
- detectorsList = await storageService.GetEntitiesByPartitionkey("Detector", startup ? DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc) : timeRange);
+ detectorsList = await storageService.GetEntitiesByPartitionkey("Detector", startup ? DateTime.MinValue : timeRange);
}
var gists = new List();
if (!LoadOnlyPublicDetectors && (!diagEntityTableCacheService.TryGetValue("Gist", out gists) || gists == null || gists.Count <1))
{
- gists = await storageService.GetEntitiesByPartitionkey("Gist", startup ? DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc) : timeRange);
+ gists = await storageService.GetEntitiesByPartitionkey("Gist", startup ? DateTime.MinValue : timeRange);
}
var filteredDetectors = LoadOnlyPublicDetectors ? detectorsList.Where(row => !row.IsInternal).ToList() : detectorsList;
if(startup)
diff --git a/src/Diagnostics.RuntimeHost/Services/StorageService/StorageService.cs b/src/Diagnostics.RuntimeHost/Services/StorageService/StorageService.cs
index e7487bba7..ad49693f8 100644
--- a/src/Diagnostics.RuntimeHost/Services/StorageService/StorageService.cs
+++ b/src/Diagnostics.RuntimeHost/Services/StorageService/StorageService.cs
@@ -99,9 +99,9 @@ public async Task> GetEntitiesByPartitionkey(string partitionKe
partitionKey = "Detector";
}
var filterPartitionKey = TableQuery.GenerateFilterCondition(PartitionKey, QueryComparisons.Equal, partitionKey);
- DateTime timeFilter = startTime ?? DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc);
+ DateTime timeFilter = startTime ?? DateTime.MinValue;
string timestampFilter = TableQuery.GenerateFilterConditionForDate("Timestamp", QueryComparisons.GreaterThanOrEqual, new DateTimeOffset(timeFilter));
- string finalFilter = timeFilter.Equals(DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc)) ? filterPartitionKey : TableQuery.CombineFilters(filterPartitionKey, TableOperators.And, timestampFilter);
+ string finalFilter = timeFilter.Equals(DateTime.MinValue) ? filterPartitionKey : TableQuery.CombineFilters(filterPartitionKey, TableOperators.And, timestampFilter);
var tableQuery = new TableQuery();
tableQuery.Where(finalFilter);
TableContinuationToken tableContinuationToken = null;
@@ -129,7 +129,7 @@ public async Task> GetEntitiesByPartitionkey(string partitionKe
} while (tableContinuationToken != null);
timeTakenStopWatch.Stop();
DiagnosticsETWProvider.Instance.LogAzureStorageMessage(nameof(StorageService), $"GetEntities by Partition key {partitionKey} took {timeTakenStopWatch.ElapsedMilliseconds}, Total rows = {detectorsResult.Count}, ClientRequestId = {clientRequestId} ");
- return startTime == DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc) ? detectorsResult.Where(result => !result.IsDisabled).ToList() :
+ return startTime == DateTime.MinValue ? detectorsResult.Where(result => !result.IsDisabled).ToList() :
detectorsResult.ToList();
}
catch (Exception ex)
diff --git a/src/Diagnostics.RuntimeHost/Startup.cs b/src/Diagnostics.RuntimeHost/Startup.cs
index c92740ed6..6735b9098 100644
--- a/src/Diagnostics.RuntimeHost/Startup.cs
+++ b/src/Diagnostics.RuntimeHost/Startup.cs
@@ -32,7 +32,6 @@
using Microsoft.Extensions.Hosting;
using Diagnostics.RuntimeHost.Services.DiagnosticsTranslator;
using Diagnostics.RuntimeHost.Services.DevOpsClient;
-using System.Text.Json.Serialization;
namespace Diagnostics.RuntimeHost
{
@@ -146,9 +145,9 @@ public void ConfigureServices(IServiceCollection services)
services.AddControllers(options =>
{
options.Filters.Add();
- }).AddJsonOptions(options =>
+ }).AddNewtonsoftJson(options =>
{
- options.JsonSerializerOptions.WriteIndented = true;
+ options.SerializerSettings.Formatting = Formatting.Indented;
});
}
else
@@ -156,10 +155,10 @@ public void ConfigureServices(IServiceCollection services)
services.AddControllers().AddJsonOptions(options =>
{
options.JsonSerializerOptions.WriteIndented = true;
- }).AddJsonOptions(options =>
+ }).AddNewtonsoftJson(options =>
{
- options.JsonSerializerOptions.WriteIndented = true;
- });
+ options.SerializerSettings.Formatting = Formatting.Indented;
+ }); ;
}
services.AddSingleton();
diff --git a/tests/Diagnostics.Tests/UtilitiesTests/DataTableUtilityTests.cs b/tests/Diagnostics.Tests/UtilitiesTests/DataTableUtilityTests.cs
index f352dde41..a5bd1b7d8 100644
--- a/tests/Diagnostics.Tests/UtilitiesTests/DataTableUtilityTests.cs
+++ b/tests/Diagnostics.Tests/UtilitiesTests/DataTableUtilityTests.cs
@@ -30,8 +30,8 @@ public void TestDataTableToDataTableResponseObject()
Assert.Equal("DateTime", columns[1].DataType);
Assert.Equal("Int32", columns[2].DataType);
- Assert.Single(convertedTable.Rows);
- Assert.Equal(3, convertedTable.Rows[0].Length);
+ Assert.Equal(1, convertedTable.Rows.GetLength(0));
+ Assert.Equal(3, convertedTable.Rows.GetLength(1));
}
[Fact]