Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApplicationInsights gives error when trying to use ServerTelemetryChannel on iOS on NET MAUI app #2899

Open
victorvitanexe opened this issue Aug 23, 2024 · 0 comments
Labels

Comments

@victorvitanexe
Copy link

victorvitanexe commented Aug 23, 2024

Package used:
Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel

Describe the bug

Just try to create a ServerTelemetryChannel in a dotnet Maui app. Works on Android. Crashes on iOS with the current error:

image

To Reproduce

private static void SetupTelemetryClient(MauiAppBuilder appBuilder, AppInsightsConfiguration configuration)
{
var telemetryConfiguration = new TelemetryConfiguration()
{
ConnectionString = configuration.ConnectionString
};
telemetryConfiguration.TelemetryInitializers.Add(new TelemetryInitializer());

        var channel = new ServerTelemetryChannel
        {
            MaxBacklogSize = configuration.MaxBacklogSize,
            MaxTelemetryBufferCapacity = configuration.MaxTelemetryBufferCapacity,
            MaxTelemetryBufferDelay = configuration.MaxTelemetryBufferDelay,
            MaxTransmissionBufferCapacity = configuration.MaxTransmissionBufferCapacity,
            MaxTransmissionSenderCapacity = configuration.MaxTransmissionSenderCapacity,
            MaxTransmissionStorageCapacity = configuration.MaxTransmissionStorageCapacity,
            StorageFolder = configuration.StorageFolder
        };
        channel.Initialize(telemetryConfiguration);

        telemetryConfiguration.TelemetryChannel = channel;

        _client = new TelemetryClient(telemetryConfiguration);
        appBuilder.Services.AddSingleton(_client);

        Connectivity.ConnectivityChanged += OnConnectivityChanged;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant