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

ConversationTranslator.SessionStarted assignment failed with AoT related issues in C# MAUI iOS (debug mode is ok, release mode failed) #2742

Open
billylo1 opened this issue Feb 14, 2025 · 0 comments

Comments

@billylo1
Copy link

billylo1 commented Feb 14, 2025

Speech SDK 1.42, C#, MAUI, iOS

Joining a conversation works in debug mode only. In release mode, a AoT related error occurred and the conversationTranslator.SessionStarted assignment failed. I tried disabling AoT but the whole app crashed on launch in release mode (so, it's not a valid workaround yet)

Android release mode works fine.

conversationTranslator = new ConversationTranslator();
conversationTranslator.SessionStarted += (s, e) =>
      {
          Debug.WriteLine($"SESSION STARTED: {e.SessionId}");
       };
Attempting to JIT compile method '(wrapper native-to-managed) void Microsoft.CognitiveServices.Speech.Internal.InteropEvent`1<Microsoft.CognitiveServices.Speech.SessionEventArgs>:FromNativeCallback (intptr,intptr,intptr)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
   at Microsoft.CognitiveServices.Speech.Internal.InteropEvent`1[[Microsoft.CognitiveServices.Speech.SessionEventArgs, Microsoft.CognitiveServices.Speech.csharp, Version=1.42.0.28, Culture=neutral, PublicKeyToken=d2e6dcccb609e663]].Add(EventHandler`1 handler)
   at Microsoft.CognitiveServices.Speech.Transcription.ConversationTranslator.add_SessionStarted(EventHandler`1 value)
   at speech_to_text.MainPage.CreateJoinConversationAsyncAndUpdateUI(String conversationId, Boolean brandNewMeeting)

To Reproduce

Steps to reproduce the behavior:

  1. Create a simple MAUI app that assigns a callback for conversationTranslator. e.g. SessionStarted
  2. Publish app to TestFlight
  3. Run app.

Expected behavior

Successfully assign the callback and continue to join the conversation.

Version of the Cognitive Services Speech SDK

1.42

Platform, Operating System, and Programming Language

iOS 18.2.1, C#

Additional context

Debug build works fine.
Disabling AoT causing other issues.

After removing that callback (for start/stop sessions), the rest of the logic works. So, I have a workaround now.

@billylo1 billylo1 changed the title ConversationTranslator.JoinConversationAsync call failed with AoT related issues in C# MAUI iOS (debug mode is ok, release mode failed) ConversationTranslator.SessionStarted assignment failed with AoT related issues in C# MAUI iOS (debug mode is ok, release mode failed) Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant