Uploaded image for project: 'Realm .NET SDK'
  1. Realm .NET SDK
  2. RNET-546

Rework native->managed callbacks to allow for managed errors

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: API
    • Labels:

      Description

      As seen in https://github.com/realm/realm-dotnet/issues/1978, if we throw an exception in a managed function called by native, that will result in a pretty hard crash. We should revisit where we invoke managed callbacks from native and figure out whether errors need to be returned and rethrown "somewhere"

      Example code that will cause an issue:

      Unable to find source-code formatter for language: csharp. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      realm.Changed += (s, e) =>
      {
      	throw new Exception("aaa");
      };
      

      We should probably design a system where managed callbacks either swallow/log all exceptions or return a pointer to the exception in native, which is then rethrown back in managed at some point.

      How important is this improvement for you?

      No response

            Assignee:
            Unassigned Unassigned
            Reporter:
            nikola.irinchev@mongodb.com Nikola Irinchev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: