From 36698e2e64d81f50de248411cd80ddfa21f7ea5e Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Thu, 29 Jun 2023 17:57:36 +0200 Subject: [PATCH] Revert Nullability of ApiCallDetails. (#84) --- src/Elastic.Transport/Responses/TransportResponse.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Elastic.Transport/Responses/TransportResponse.cs b/src/Elastic.Transport/Responses/TransportResponse.cs index d7dc24b..3f27ecc 100644 --- a/src/Elastic.Transport/Responses/TransportResponse.cs +++ b/src/Elastic.Transport/Responses/TransportResponse.cs @@ -23,14 +23,16 @@ public abstract class TransportResponse : TransportResponse /// public abstract class TransportResponse { - /// - /// - /// + /// Returns details about the API call that created this response. [JsonIgnore] - public ApiCallDetails? ApiCallDetails { get; internal set; } + // TODO: ApiCallDetails is always set, but nothing enforces it + // since we use new() generic constraint we can not enforce a protected constructor. + // ReSharper disable once NotNullOrRequiredMemberIsNotInitialized + public ApiCallDetails ApiCallDetails { get; internal set; } /// public override string ToString() => ApiCallDetails?.DebugInformation - ?? $"{nameof(ApiCallDetails)} not set reverting to default ToString(): {base.ToString()}"; + // ReSharper disable once ConstantNullCoalescingCondition + ?? $"{nameof(ApiCallDetails)} not set, likely a bug, reverting to default ToString(): {base.ToString()}"; }