I have an MVVM MAUI app that is working fine when running in Visual Studio in debug mode. If I build for release and deploy and run, it crashes when a change in the UI causes MVVM to tell sync to send back a change. The error is “Cannot modify managed objects outside of a write transaction.”. I know what that message means but here it is when Realm code is being notified of a data change in the UI via MVVM so it is not my own code that is changing data without a transaction.
To test this theory, I ran the “House Moving Assistant” sample app as demo’ed by @Luce_Carter at the .Net MAUI conference and it has the same problem when I build it for release. Again it works fine when running in Visual Studio in debug mode. In this sample app, I can add tasks but when I tap one to update its status the app crashes and log cat shows the above error. I’ll include part of the log below.
I see the same on a Samsung phone (Android 12) and a Samsung tablet (Android 11).
John.
Log excerpts
08-20 23:07:22.724 20309 20309 E AndroidRuntime: FATAL EXCEPTION: main
08-20 23:07:22.724 20309 20309 E AndroidRuntime: Process: uk.co.lucyscarter.housemovingassistant, PID: 20309
08-20 23:07:22.724 20309 20309 E AndroidRuntime: android.runtime.JavaProxyThrowable: System.Reflection.TargetInvocationException: Arg_TargetInvocationException
08-20 23:07:22.724 20309 20309 E AndroidRuntime: ---> Realms.Exceptions.RealmInvalidTransactionException: Cannot modify managed objects outside of a write transaction.
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Realms.NativeException.ThrowIfNecessary(Func`2 overrider)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Realms.ObjectHandle.SetValue(String propertyName, Metadata metadata, RealmValue& value, Realm realm)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Realms.RealmObjectBase.SetValue(String propertyName, RealmValue val)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at HouseMovingAssistant.Models.MovingTask.set_Name(String value)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at HouseMovingAssistant.Views.EditTaskPage.<InitializeComponent>typedBindingsM__1(EditMovingTaskPageViewModel , String )
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.Internals.TypedBinding`2[[HouseMovingAssistant.ViewModels.EditMovingTaskPageViewModel, HouseMovingAssistant, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ApplyCore(Object sourceObject, BindableObject target, BindableProperty property, Boolean fromTarget)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.Internals.TypedBinding`2[[HouseMovingAssistant.ViewModels.EditMovingTaskPageViewModel, HouseMovingAssistant, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Apply(Boolean fromTarget)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.Internals.TypedBinding`2[[HouseMovingAssistant.ViewModels.EditMovingTaskPageViewModel, HouseMovingAssistant, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ApplyCore(Object sourceObject, BindableObject target, BindableProperty property, Boolean fromTarget)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.Internals.TypedBinding`2[[HouseMovingAssistant.ViewModels.EditMovingTaskPageViewModel, HouseMovingAssistant, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Apply(Boolean fromTarget)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.Internals.TypedBinding`2.PropertyChangedProxy[[HouseMovingAssistant.ViewModels.EditMovingTaskPageViewModel, HouseMovingAssistant, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].<OnPropertyChanged>b__16_0()
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.DispatcherExtensions.DispatchIfRequired(IDispatcher dispatcher, Action action)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.Internals.TypedBinding`2.PropertyChangedProxy[[HouseMovingAssistant.ViewModels.EditMovingTaskPageViewModel, HouseMovingAssistant, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].OnPropertyChanged(Object sender, PropertyChangedEventArgs e)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.BindingExpression.WeakPropertyChangedProxy.OnPropertyChanged(Object sender, PropertyChangedEventArgs e)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at CommunityToolkit.Mvvm.ComponentModel.ObservableObject.OnPropertyChanged(PropertyChangedEventArgs )
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at HouseMovingAssistant.ViewModels.EditMovingTaskPageViewModel.set_MovingTask(MovingTask value)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at System.Reflection.RuntimeMethodInfo.Invoke(Object , BindingFlags , Binder , Object[] , CultureInfo )
08-20 23:07:22.724 20309 20309 E AndroidRuntime: Exception_EndOfInnerExceptionStack
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at System.Reflection.RuntimeMethodInfo.Invoke(Object , BindingFlags , Binder , Object[] , CultureInfo )
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at System.Reflection.RuntimePropertyInfo.SetValue(Object , Object , BindingFlags , Binder , Object[] , CultureInfo )
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at System.Reflection.PropertyInfo.SetValue(Object , Object , Object[] )
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at System.Reflection.PropertyInfo.SetValue(Object , Object )
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.ShellContent.ApplyQueryAttributes(Object content, ShellRouteParameters query, ShellRouteParameters oldQuery)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.ShellContent.ApplyQueryAttributes(Object content, ShellRouteParameters query, ShellRouteParameters oldQuery)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.ShellContent.OnQueryAttributesPropertyChanged(BindableObject bindable, Object oldValue, Object newValue)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value, Boolean fromStyle, Boolean checkAccess)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.ShellNavigationManager.ApplyQueryAttributes(Element element, ShellRouteParameters query, Boolean isLastItem, Boolean isPopping)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.ShellSection.GetOrCreateFromRoute(String route, ShellRouteParameters queryData, IServiceProvider services, Boolean isLast, Boolean isPopping)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.ShellSection.GoToAsync(ShellNavigationRequest request, ShellRouteParameters queryData, IServiceProvider services, Nullable`1 animate, Boolean isRelativePopping)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Microsoft.Maui.Controls.ShellNavigationManager.GoToAsync(ShellNavigationParameters shellNavigationParameters, ShellNavigationRequest navigationRequest)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at HouseMovingAssistant.ViewModels.MovingTasksPageViewModel.EditTask(MovingTask task)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at CommunityToolkit.Mvvm.Input.AsyncRelayCommand.AwaitAndThrowIfFailed(Task )
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object )
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Android.App.SyncContext.<>c__DisplayClass2_0.<Post>b__0()
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Java.Lang.Thread.RunnableImplementor.Run()
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Java.Lang.IRunnableInvoker.n_Run(IntPtr , IntPtr )
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V , IntPtr , IntPtr )
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at mono.java.lang.RunnableImplementor.n_run(Native Method)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:938)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at android.os.Looper.loop(Looper.java:247)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8676)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
08-20 23:07:22.724 20309 20309 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
08-20 23:07:22.728 20309 20309 W monodroid-assembly: Shared library 'liblog' not loaded, p/invoke '__android_log_print' may fail
08-20 23:07:22.728 20309 20309 I MonoDroid: UNHANDLED EXCEPTION:
08-20 23:07:22.733 20309 20309 I MonoDroid: Android.Runtime.JavaProxyThrowable: Exception_WasThrown, Android.Runtime.JavaProxyThrowable
08-20 23:07:22.733 20309 20309 I MonoDroid:
08-20 23:07:22.733 20309 20309 I MonoDroid: --- End of managed Android.Runtime.JavaProxyThrowable stack trace ---
08-20 23:07:22.733 20309 20309 I MonoDroid: android.runtime.JavaProxyThrowable: System.Reflection.TargetInvocationException: Arg_TargetInvocationException
08-20 23:07:22.733 20309 20309 I MonoDroid: ---> Realms.Exceptions.RealmInvalidTransactionException: Cannot modify managed objects outside of a write transaction.
08-20 23:07:22.733 20309 20309 I MonoDroid: at Realms.NativeException.ThrowIfNecessary(Func`2 overrider)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Realms.ObjectHandle.SetValue(String propertyName, Metadata metadata, RealmValue& value, Realm realm)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Realms.RealmObjectBase.SetValue(String propertyName, RealmValue val)
08-20 23:07:22.733 20309 20309 I MonoDroid: at HouseMovingAssistant.Models.MovingTask.set_Name(String value)
08-20 23:07:22.733 20309 20309 I MonoDroid: at HouseMovingAssistant.Views.EditTaskPage.<InitializeComponent>typedBindingsM__1(EditMovingTaskPageViewModel , String )
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.Internals.TypedBinding`2[[HouseMovingAssistant.ViewModels.EditMovingTaskPageViewModel, HouseMovingAssistant, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ApplyCore(Object sourceObject, BindableObject target, BindableProperty property, Boolean fromTarget)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.Internals.TypedBinding`2[[HouseMovingAssistant.ViewModels.EditMovingTaskPageViewModel, HouseMovingAssistant, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Apply(Boolean fromTarget)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.Internals.TypedBinding`2[[HouseMovingAssistant.ViewModels.EditMovingTaskPageViewModel, HouseMovingAssistant, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ApplyCore(Object sourceObject, BindableObject target, BindableProperty property, Boolean fromTarget)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.Internals.TypedBinding`2[[HouseMovingAssistant.ViewModels.EditMovingTaskPageViewModel, HouseMovingAssistant, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Apply(Boolean fromTarget)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.Internals.TypedBinding`2.PropertyChangedProxy[[HouseMovingAssistant.ViewModels.EditMovingTaskPageViewModel, HouseMovingAssistant, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].<OnPropertyChanged>b__16_0()
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.DispatcherExtensions.DispatchIfRequired(IDispatcher dispatcher, Action action)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.Internals.TypedBinding`2.PropertyChangedProxy[[HouseMovingAssistant.ViewModels.EditMovingTaskPageViewModel, HouseMovingAssistant, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].OnPropertyChanged(Object sender, PropertyChangedEventArgs e)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.BindingExpression.WeakPropertyChangedProxy.OnPropertyChanged(Object sender, PropertyChangedEventArgs e)
08-20 23:07:22.733 20309 20309 I MonoDroid: at CommunityToolkit.Mvvm.ComponentModel.ObservableObject.OnPropertyChanged(PropertyChangedEventArgs )
08-20 23:07:22.733 20309 20309 I MonoDroid: at HouseMovingAssistant.ViewModels.EditMovingTaskPageViewModel.set_MovingTask(MovingTask value)
08-20 23:07:22.733 20309 20309 I MonoDroid: at System.Reflection.RuntimeMethodInfo.Invoke(Object , BindingFlags , Binder , Object[] , CultureInfo )
08-20 23:07:22.733 20309 20309 I MonoDroid: Exception_EndOfInnerExceptionStack
08-20 23:07:22.733 20309 20309 I MonoDroid: at System.Reflection.RuntimeMethodInfo.Invoke(Object , BindingFlags , Binder , Object[] , CultureInfo )
08-20 23:07:22.733 20309 20309 I MonoDroid: at System.Reflection.RuntimePropertyInfo.SetValue(Object , Object , BindingFlags , Binder , Object[] , CultureInfo )
08-20 23:07:22.733 20309 20309 I MonoDroid: at System.Reflection.PropertyInfo.SetValue(Object , Object , Object[] )
08-20 23:07:22.733 20309 20309 I MonoDroid: at System.Reflection.PropertyInfo.SetValue(Object , Object )
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.ShellContent.ApplyQueryAttributes(Object content, ShellRouteParameters query, ShellRouteParameters oldQuery)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.ShellContent.ApplyQueryAttributes(Object content, ShellRouteParameters query, ShellRouteParameters oldQuery)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.ShellContent.OnQueryAttributesPropertyChanged(BindableObject bindable, Object oldValue, Object newValue)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value, Boolean fromStyle, Boolean checkAccess)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.ShellNavigationManager.ApplyQueryAttributes(Element element, ShellRouteParameters query, Boolean isLastItem, Boolean isPopping)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.ShellSection.GetOrCreateFromRoute(String route, ShellRouteParameters queryData, IServiceProvider services, Boolean isLast, Boolean isPopping)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.ShellSection.GoToAsync(ShellNavigationRequest request, ShellRouteParameters queryData, IServiceProvider services, Nullable`1 animate, Boolean isRelativePopping)
08-20 23:07:22.733 20309 20309 I MonoDroid: at Microsoft.Maui.Controls.ShellNavigationManager.GoToAsync(ShellNavigationParameters shellNavigationParameters, ShellNavigationRequest navigationRequest)
08-20 23:07:22.733 20309 20309 I MonoDroid: at HouseMovingAssistant.ViewModels.MovingTasksPageViewModel.EditTask(MovingTask task)
08-20 23:07:22.733 20309 20309 I MonoDroid: at CommunityToolkit.Mvvm.Input.AsyncRelayCommand.AwaitAndThrowIfFailed(Task )
08-20 23:07:22.733 20309 20309 I MonoDroid: at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object )
08-20 23:07:22.733 20309 20309 I MonoDroid: at Android.App.SyncContext.<>c__DisplayClass2_0.<Post>b__0()
08-20 23:07:22.733 20309 20309 I MonoDroid: at Java.Lang.Thread.RunnableImplementor.Run()
08-20 23:07:22.733 20309 20309 I MonoDroid: at Java.Lang.IRunnableInvoker.n_Run(IntPtr , IntPtr )
08-20 23:07:22.733 20309 20309 I MonoDroid: at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V , IntPtr , IntPtr )
08-20 23:07:22.733 20309 20309 I MonoDroid: at mono.java.lang.RunnableImplementor.n_run(Native Method)
08-20 23:07:22.733 20309 20309 I MonoDroid: at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
08-20 23:07:22.733 20309 20309 I MonoDroid: at android.os.Handler.handleCallback(Handler.java:938)
08-20 23:07:22.733 20309 20309 I MonoDroid: at android.os.Handler.dispatchMessage(Handler.java:99)
08-20 23:07:22.733 20309 20309 I MonoDroid: at android.os.Looper.loop(Looper.java:247)
08-20 23:07:22.733 20309 20309 I MonoDroid: at android.app.ActivityThread.main(ActivityThread.java:8676)
08-20 23:07:22.733 20309 20309 I MonoDroid: at java.lang.reflect.Method.invoke(Native Method)
08-20 23:07:22.733 20309 20309 I MonoDroid: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
08-20 23:07:22.733 20309 20309 I MonoDroid: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
08-20 23:07:22.733 20309 20309 I MonoDroid:
08-20 23:07:22.733 20309 20309 I MonoDroid: --- End of managed Android.Runtime.JavaProxyThrowable stack trace ---