I have a custome message handler in a MAUI Blazor App for handling API request handling like Loading spinner, defining request header,and checking api exception
public class CustomHttpRequestHandler : DelegatingHandler{}and there is another httpclientHandler for handling SSL pinning
public class HttpsValidation : HttpClientHandler{public HttpsValidation(){ AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate | DecompressionMethods.Brotli; UseProxy = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; ServerCertificateCustomValidationCallback = OnValidateCertificate;}}assigning the two handler in DI as follow
builder.Services.AddHttpClient<HttpClient>("MyhttpClient", client => client.BaseAddress = new Uri(BaseUrl) ).ConfigureHttpMessageHandlerBuilder(builder => builder.PrimaryHandler = new HttpClientHandler() { UseDefaultCredentials = true } ).ConfigurePrimaryHttpMessageHandler(() => new HttpsValidation()) .AddHttpMessageHandler<CustomHttpRequestHandler>();defining the http client in RestService as follow
_httpClient = _thttpClientFactory.CreateClient("MyhttpClient");
Really the app is working fine but sometimes this issue appears suddenly even sometimes when the app is idle for a while I get this error as follow
blazor.webview.js:1 The 'InnerHandler' property must be null. 'DelegatingHandler' instances provided to 'HttpMessageHandlerBuilder' must not be reused or cached.Handler: 'CustomHttpRequestHandler '
Expected the app to run fine without any issues