influxdb-client-csharp
influxdb-client-csharp copied to clipboard
Adding support to run in blazor wasm ?
I am trying to get the client db api to run in a blazor app and am getting a platform not supported error, are you planning to allow the library to work with blazor web assembly ?
` var influxDBClient = InfluxDBClientFactory.Create("https://us-west-2-1.aws.cloud2.influxdata.com/", Token);
int i = 0;
var fluxTables = await influxDBClient.GetQueryApi().QueryAsync(flux, orgid);
fluxTables.ForEach(fluxTable =>
{
var fluxRecords = fluxTable.Records;
fluxRecords.ForEach(fluxRecord =>
{
Console.WriteLine(i + "\t" + $"{fluxRecord.GetTime()}\t{fluxRecord.GetValue()}\t{fluxRecord.GetValueByIndex(8)}");
i++;
});
});
`
Hi @intech-paul,
The Blazor doesn't have a full support of netstandard2.0
:
APIs that aren't applicable inside of a web browser (for example, accessing the file system, opening a socket, and threading) throw a PlatformNotSupportedException.
https://docs.microsoft.com/cs-cz/aspnet/core/blazor/?view=aspnetcore-3.1#code-sharing-and-net-standard
So I thing there is no easy way how to add supports for blazor
, but definitely we want to support a whole dotnet
stack.
Is this something you might be willing to help with?
Regards
Hi, I think this is beyond my experience level.
The exception that is thrown is:
Operation is not supported on this platform. at RestSharp.RestClient.DownloadData (RestSharp.IRestRequest request, System.Boolean throwOnError) <0x38203e8 + 0x00040> in 2[T1,T2] consumer, System.Action
1[T] onError, System.Action onComplete) <0x38112c8 + 0x0023a> in 1[T] onError, System.Action onComplete) <0x3809478 + 0x00122> in <filename unknown>:0 at InfluxDB.Client.QueryApi.QueryAsync (InfluxDB.Client.Api.Domain.Query query, System.String org, InfluxDB.Client.Core.Flux.Internal.FluxCsvParser+IFluxResponseConsumer consumer, System.Action
1[T] onError, System.Action onComplete) <0x34e0ff8 + 0x00142> in
I would guess that this is because RestSharp.RestClient is not using HtppClient which is supported on blazor.
There is a item already mentioned for this in RestSHarp: https://github.com/restsharp/RestSharp/issues/1406
Thanks for detail info.
Yeah RestSharp
is a source of problem 😞 .
Unfortunately OpenApi
generators uses RestSharp
as a http client. We could try use a https://github.com/RicoSuter/NSwag but currently we don't have a time-plan for that.