Skip to content

Unexpected Exception #2400

@ivanrlg

Description

@ivanrlg

Goals

Discover the cause of the exception

Expected Results

Not have the unexpected exception

Actual Results

Entrando GetTokenAsync: 5/25/2021 7:42:59 PM
The thread 0x3808 has exited with code 0 (0x0).
'FusionMedicalRealm.UWP.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Shell.ServiceHostBuilder.dll'.
The thread 0x41f0 has exited with code 0 (0x0).
Exception thrown at 0x00007FFCAB8F4B89 (KernelBase.dll) in FusionMedicalRealm.UWP.exe: 0x000006D9: There are no more endpoints available from the endpoint mapper.
onecoreuap\base\appmodel\statemanager\roamingrpc\stateroamingrpcclient.cpp(124)\Windows.Storage.ApplicationData.dll!00007FFC801A3CB8: (caller: 00007FFC801A4586) ReturnHr(5) tid(1268) 800706D9 There are no more endpoints available from the endpoint mapper.
    Msg:[c_SignalRoamingDataChange 2]
Entrando CheckSessions: 5/25/2021 7:43:01 PM
Entrando SetUserFromObjet: 5/25/2021 7:43:01 PM
      In GetInstanceAsync  Time: 5/25/2021 7:43:03 PM
Progress Realm: 345 Mb /345 Mb
Exception thrown at 0x00007FFCAB8F4B89 in FusionMedicalRealm.UWP.exe: Microsoft C++ exception: EEMessageException at memory location 0x0000008FEFC7E2C0.
The thread 0x3ee8 has exited with code 0 (0x0).
      In GetInstanceAsync  Time: 5/25/2021 7:43:05 PM
Progress Realm: 345 Mb /345 Mb
Exception thrown at 0x00007FFCAB8F4B89 in FusionMedicalRealm.UWP.exe: Microsoft C++ exception: EEMessageException at memory location 0x0000008FEFC7E2C0.
      In GetInstanceAsync  Time: 5/25/2021 7:43:05 PM
Progress Realm: 345 Mb /345 Mb
Exception thrown at 0x00007FFCAB8F4B89 in FusionMedicalRealm.UWP.exe: Microsoft C++ exception: EEMessageException at memory location 0x0000008FEFC7E2C0.
An unhandled exception of type 'System.NullReferenceException' occurred in Realm.dll
Object reference not set to an instance of an object.

Steps to Reproduce

When installing on a new device after syncing the first time, the exception occurs when I try to search for a record.

I have tried to catch him with a try but it is not possible.

It is important to note that after the exception occurs, the second time I try to enter the app it no longer happens.

Code Sample

 try
            {
                SessionsModel SessionByIdApp = (await SessionsServices.ReadByPredicate(p => p.IdApp == IdApp && p.Email == Email)).Data.LastOrDefault();
                if (SessionByIdApp != null)
                {
                    SessionsModel.Id = SessionByIdApp.Id;
                    SessionsModel.IsActive = SessionByIdApp.IsActive;
                    IResponse = await SessionsServices.Insert(SessionsModel);
                    return await ResponseSessions(Email, Message, SuscriptionIsValid.MaxSession, IResponse, SessionsModel.Id, IsActive, SessionByIdApp.IsActive);
                }

                SessionsModel.IsActive = true;
                IResponse = await SessionsServices.Insert(SessionsModel);

               --------------> here Exepction.
                SessionByIdApp = (await SessionsServices.ReadByPredicate(p => p.IdApp == IdApp && p.Email == Email)).Data.LastOrDefault();
                return await ResponseSessions(Email, Message, SuscriptionIsValid.MaxSession, IResponse, SessionByIdApp.Id, IsActive, SessionByIdApp.IsActive);

            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                return null;
            }

        public async Task<IDataResponse<IEnumerable<SessionsModel>>> ReadAsync(Expression<Func<SessionsModel, bool>> predicate)
        {
            IEnumerable<Sessions> resultDto;
            IEnumerable<SessionsModel> result;

            var realmInstance = await _realmManager.GetInstanceAsync();
            if (realmInstance == null)
                return new DataResponse<IEnumerable<SessionsModel>>(null, false, "Realm instance can't be null");

            var afterParameter = Expression.Parameter(typeof(Sessions), predicate.Name);
            var visitor = new ExpressionExtension(predicate, afterParameter);
            var newPredicate = Expression.Lambda<Func<Sessions, bool>>(visitor.Visit(predicate.Body), afterParameter);

            resultDto = realmInstance.All<Sessions>()
                                     .Where(newPredicate);
            result = resultDto.ToModel();

            return new DataResponse<IEnumerable<SessionsModel>>(result, result != null);
        }

Image Exception:
https://ibb.co/fX0q8Hn

Version of Realm and Tooling

  • Realm Object Server Version: ? (you can see this as well in Studio once connected to a Realm instance)
  • Flavor:
    Xamarin

Android & UWP.

Client SDK Version: Realm 10.1.4.
Client OS & Version: Android 9/10. / Windows 10.
Microsoft Visual Studio Community 2019
Version 16.9.6

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions