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

Android IL2CPP Weak References error #16

Closed
batonPiotr opened this issue Jul 12, 2020 · 2 comments
Closed

Android IL2CPP Weak References error #16

batonPiotr opened this issue Jul 12, 2020 · 2 comments

Comments

@batonPiotr
Copy link

Hello!

I have following issue: I bind a very simple view with one button:

dataContext = new MainMenuViewModel(commandDelay);
this.SetDataContext(dataContext);

/* databinding */
BindingSet<MainMenuViewController, MainMenuViewModel> bindingSet = this.CreateBindingSet<MainMenuViewController, MainMenuViewModel>();
bindingSet.Bind(this.runButton).For(v => v.onClick).To(vm => vm.OnRun).OneWay();

bindingSet.Build();

OnRun in this case is a simple public void method in the MainMenuViewModel. It works just fine in the editor but when I compile it to android I get following error:

2020-07-12 22:25:45.695 [ERROR] BindingSetBase - Loxodon.Framework.Binding.BindingException: An exception occurred while building the data binding for {binding onClick Path:OnRun Mode:OneWay }. ---> System.NotSupportedException: /Applications/Unity/2019.3.0f5/Unity.app/Contents/il2cpp/libil2cpp/gc/GCHandle.cpp(183) : Unsupported internal call for IL2CPP:GCHandle::NewWeakref - "IL2CPP does not support resurrection for weak references. Pass the trackResurrection with a value of false."
  at System.Runtime.InteropServices.GCHandle.Alloc (System.Object value, System.Runtime.InteropServices.GCHandleType type) [0x00000] in <00000000000000000000000000000000>:0 
  at System.WeakReference.AllocateHandle (System.Object target) [0x00000] in <00000000000000000000000000000000>:0 
  at Loxodon.Framework.Binding.AbstractBinding..ctor (Loxodon.Framework.Binding.Contexts.IBindingContext bindingContext, System.Object dataContext, System.Object target) [0x00000] in <00000000000000000000000000000000>:0 
  at Loxodon.Framework.Binding.Binding..ctor (Loxodon.Framework.Binding.Contexts.IBindingContext bindingContext, System.Object source, System.Object target, Loxodon.Framework.Binding.BindingDescription bindingDescription, Loxodon.Framework.Binding.Proxy.Sources.ISourceProxyFactory sourceProxyFactory, Loxodon.Framework.Binding.Proxy.Targets.ITargetProxyFactory targetProxyFactory) [0x00000] in <00000000000000000000000000000000>:0 
  at Loxodon.Framework.Binding.BindingFactory.Create (Loxodon.Framework.Binding.Contexts.IBindingContext bindingContext, System.Object source, System.Object target, Loxodon.Framework.Binding.BindingDescription bindingDescription) [0x00000] in <00000000000000000000000000000000>:0 
  at Loxodon.Framework.Binding.Contexts.BindingContext.Add (System.Object target, Loxodon.Framework.Binding.BindingDescription description, System.Object key) [0x00000] in <00000000000000000000000000000000>:0 
  at Loxodon.Framework.Binding.Builder.BindingBuilderBase.Build () [0x00000] in <00000000000000000000000000000000>:0 
  at Loxodon.Framework.Binding.Builder.BindingSetBase.Build () [0x00000] in <00000000000000000000000000000000>:0 
  at IslandRunner.UI.MainMenuViewController.<Start>b__3_0 () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Action.Invoke () [0x00000] in <00000000000000000000000000000000>:0 
  at Run+<_RunAfter>d__9.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0 
   --- End of inner exception stack trace ---
  at Loxodon.Framework.Binding.Builder.BindingBuilderBase.Build () [0x00000] in <00000000000000000000000000000000>:0 
  at Loxodon.Framework.Binding.Builder.BindingSetBase.Build () [0x00000] in <00000000000000000000000000000000>:0 
  at IslandRunner.UI.MainMenuViewController.<Start>b__3_0 () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Action.Invoke () [0x00000] in <00000000000000000000000000000000>:0 
  at Run+<_RunAfter>d__9.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0 
Loxodon.Framework.Binding.Builder.BindingSetBase:Build()
IslandRunner.UI.MainMenuViewController:<Start>b__3_0()
System.Action:Invoke()
<_RunAfter>d__9:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

It must have been because of the newest update. I've used this case before without problems in older versions but I cannot recall which one was it.

@vovgou
Copy link
Owner

vovgou commented Jul 13, 2020

Thank you very much!
I have fixed this bug, please use version 1.9.12.

@batonPiotr
Copy link
Author

It has solved the issue, thank you!

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

2 participants