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

Exception in CrossNewRelic.Current while try to run on iOS. #48

Open
SuryaCheran opened this issue Oct 1, 2024 · 9 comments
Open

Exception in CrossNewRelic.Current while try to run on iOS. #48

SuryaCheran opened this issue Oct 1, 2024 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@SuryaCheran
Copy link

SuryaCheran commented Oct 1, 2024

I have followed the steps in Read.me and when I tried to run the iOS app I'm getting exception as "This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation."
Note : Issue is only on iOS
#if IOS

         AppLifecycle.AddiOS(iOS => iOS.WillFinishLaunching((_,__) => {
            StartNewRelic();
            return false;
        }));
    private static void StartNewRelic()
    {
        try
        {
            CrossNewRelic.Current.HandleUncaughtException();
            CrossNewRelic.Current.TrackShellNavigatedEvents();

            // Options are: crashReportingEnabled, loggingEnabled, logLevel, collectorAddress, crashCollectorAddress,analyticsEventEnabled, networkErrorRequestEnabled, networkRequestEnabled, interactionTracingEnabled,webViewInstrumentation, fedRampEnabled,offlineStorageEnabled,newEventSystemEnabled,backgroundReportingEnabled

            AgentStartConfiguration agentConfig = new AgentStartConfiguration(true, true, NewRelic.MAUI.Plugin.LogLevel.INFO, interactionTracingEnabled: false, backgroundReportingEnabled: true);

            if (DeviceInfo.Current.Platform == DevicePlatform.Android)
            {
                CrossNewRelic.Current.Start("MY_TOKEN-android", agentConfig);
            }
            else if (DeviceInfo.Current.Platform == DevicePlatform.iOS)
            {
                CrossNewRelic.Current.Start("MY_TOKEN-iOS", agentConfig);
            }
        }
        catch (Exception ex)
        {
        }
    }
}

NewRelic_Issue

Steps to Reproduce

  • Integrate NewRelic as per the readme
  • Run on ios
  • Will get an excpetion in CrossNewRelic.Current in StartNewRelic()
@SuryaCheran SuryaCheran added the bug Something isn't working label Oct 1, 2024
@ndesai-newrelic
Copy link
Contributor

@SuryaCheran you should invoke "CrossNewRelic.Current.TrackShellNavigatedEvents();" after creating the AppShell of the app.We will update our documentation to clarify this. we are unable to reproduce the issue from our side.

@SuryaCheran
Copy link
Author

Hi @ndesai-newrelic ,
I have tried it as per your suggestion but the issue is still there. Any Other Alternative workarounds ?
Note : I have installed the latest Nuget Package.

@ndesai-newrelic
Copy link
Contributor

@SuryaCheran can you share your example app for this?

@ndesai-newrelic ndesai-newrelic self-assigned this Oct 4, 2024
@vikashhd
Copy link

vikashhd commented Oct 6, 2024

We are also getting same exception. Nothing special we are using same code that you provided in example.
Env is .Net 8 ios

With same code we are able to open our app with Relic version 1.0.0
But getting exception for >1.0.0

@ndesai-newrelic
Copy link
Contributor

@vikashhd can you share sample app for this?

@SuryaCheran
Copy link
Author

Hi @ndesai-newrelic ,
Sorry for the delay . I couldn't able to upload the sample app because of size restriction..
Still Im experiencing the same issue. I might doubt NewRelic.MAUI.iOS.Binding is not installed properly..But I have the reference in project file. Is there any possibility like this ?
Note : Currently I have installed to Nuget package via VSCode and even I tried to install NewRelic.MAUI.iOS.Binding in Windows but i faced a path error
as System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\surya.cheran.nuget\packages\newrelic.maui.ios.binding\7.5.2\lib\net8.0-ios18.0\NewRelic.MAUI.iOS.Binding.resources\NewRelic.xcframework\ios-arm64_x86_64-simulator\NewRelic.framework\Modules\NewRelic.swiftmodule\arm64-apple-ios-simulator.private.swiftinterface'.

Nuget Package Installed:
1.NewRelic.MAUI.iOS.Binding Version ="7.5.0"
2.NewRelic.MAUI.Plugin Version="1.1.3"

image
.

@ndesai-newrelic
Copy link
Contributor

@SuryaCheran this is known issue and we cant do anything from our side. #24

@bennoschoonraad
Copy link

bennoschoonraad commented Nov 13, 2024

I also run into this issue with NewRelic.MAUI.Plugin Version 1.1.4. when using GetHttpMessageHandler. As an example:
image

When running the application for iOS - the application crashes with the error:

An error occurred: 'This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.'. Callstack: '   at NewRelic.MAUI.Plugin.CrossNewRelic.get_Current()

This was not an issue in version 1.1.0 of the NewRelic.MAUI.Plugin.

Update

Including the following package (and the Android equivalent) in my project's .csproj seemed to resolve the issue.
image

@daniel-mamnev-bg
Copy link

@bennoschoonraad I am getting some ILLINK errors when adding the binding projects for ios. If we need this, why didn't they add that in the readme? I have been trying for days to fix a crashing issue that only happens on ios when running from testflight. Release mode does not have an issue when running locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants