Closed marcoseraphin closed 7 years ago
That's the first time I've seen this error. While we investigate, you could try switching to the beta/alpha channel to see if the error is still there.
Yes....I will try switching to beta. Additional information. I run the Android app in debug mode but all Realm data is null reading from the database.
I will report with further info.
Thanx
Marco
I switched to the VS Studio for Mac beta channel....no updates right now. Alpha channel is to risky, I am in a production project right now.
Please give me more information if you have investigated the case.
Thank you
Marco
An old (backup) solution with Realm 1.5.0 database NuGet package creates the same MTOUCH error...;-(
Any news about the MTOUCH linking error ?
Sad to say, but a small test project just with the Realm Nuget packages and the RealmObject class did NOT reproduce the linking error. Only in my big customer project...;-)
But I do not have any idea why I get the linking error ?
Any hints ?
Best
Marco
I'm struggling to reproduce it either, so no updates here. As a workaround, could you try to downgrade your VS for Mac to the previous stable version?
Another weired thing.
In release mode (it compiles without errors) the app did not work. It does not write any database record.
Than I changed this line:
var settingsObject = realmDB.CreateObject("DBSettingsObjekt");
to the typed form like this:
DBSettingsObjekt settingsObject = realmDB.CreateObject("DBSettingsObjekt");
After this change the app seems to work correctly.
Best
Marco
can I downgrade within the VS for Mac ? or is there a extra download ?
Marco
Nope...I installed an older Version of VS for mac (Version 7.0.1, Build 24) again the same error "MTOUCH....value cannot be null". I also tried with an older version of my project with Realm Nuget package version 1.5.0 and some other older packages....still the same error.
Marco
This looks like a Xamarin issue with dynamic objects. I expect that the untyped version is throwing an exception, try to catch it and print the message + stack trace.
Here is the message:
{System.PlatformNotSupportedException: Operation is not supported on this platform. at System.Runtime.InteropServices.Marshal.IsComObject (System.Object o) [0x00000] in <183b200ee49746d48fc781625979428e>:0 at Microsoft.CSharp.RuntimeBinder.BinderHelper.IsC…}
An here the StackTrace:
at System.Runtime.InteropServices.Marshal.IsComObject (System.Object o) [0x00000] in <183b200ee49746d48fc781625979428e>:0
at Microsoft.CSharp.RuntimeBinder.BinderHelper.IsComObject (System.Object obj) [0x00003] in <0c600cab29754882aa1761854aaa8abf>:0
at Microsoft.CSharp.RuntimeBinder.BinderHelper.IsDynamicallyTypedRuntimeProxy (System.Dynamic.DynamicMetaObject argument, Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo info) [0x00011] in <0c600cab29754882aa1761854aaa8abf>:0
at Microsoft.CSharp.RuntimeBinder.BinderHelper.DeduceArgumentRestriction (System.Int32 parameterIndex, Microsoft.CSharp.RuntimeBinder.ICSharpInvokeOrInvokeMemberBinder callPayload, System.Dynamic.DynamicMetaObject argument, Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo info) [0x00011] in <0c600cab29754882aa1761854aaa8abf>:0
at Microsoft.CSharp.RuntimeBinder.BinderHelper.Bind (System.Dynamic.DynamicMetaObjectBinder action, Microsoft.CSharp.RuntimeBinder.RuntimeBinder binder, System.Dynamic.DynamicMetaObject[] args, System.Collections.Generic.IEnumerable1[T] arginfos, System.Dynamic.DynamicMetaObject onBindingError) [0x000a3] in <0c600cab29754882aa1761854aaa8abf>:0 at Microsoft.CSharp.RuntimeBinder.CSharpSetMemberBinder.FallbackSetMember (System.Dynamic.DynamicMetaObject target, System.Dynamic.DynamicMetaObject value, System.Dynamic.DynamicMetaObject errorSuggestion) [0x00000] in <0c600cab29754882aa1761854aaa8abf>:0 at System.Dynamic.SetMemberBinder.FallbackSetMember (System.Dynamic.DynamicMetaObject target, System.Dynamic.DynamicMetaObject value) [0x00000] in <b5bd9d990a0b4733885e90ca5ec6c0fb>:0 at System.Dynamic.DynamicMetaObject.BindSetMember (System.Dynamic.SetMemberBinder binder, System.Dynamic.DynamicMetaObject value) [0x0000b] in <b5bd9d990a0b4733885e90ca5ec6c0fb>:0 at System.Dynamic.SetMemberBinder.Bind (System.Dynamic.DynamicMetaObject target, System.Dynamic.DynamicMetaObject[] args) [0x00035] in <b5bd9d990a0b4733885e90ca5ec6c0fb>:0 at System.Dynamic.DynamicMetaObjectBinder.Bind (System.Object[] args, System.Collections.ObjectModel.ReadOnlyCollection
1[T] parameters, System.Linq.Expressions.LabelTarget returnLabel) [0x000c6] in
Marco
Are you sure Realm is causing the error? If you have it with the old version of VS for Mac and with an older Realm version, could it be something else changed in your project?
Regarding the dynamic CreateObject
issue, it's caused by a Xamarin bug: https://bugzilla.xamarin.com/show_bug.cgi?id=57919#c22. There's a prerelease build in the linked comment you can try out.
Thank you for your investigation. Concerning the linker error: If I am honest: Think yes you are right. I could not reproduce the error after updating VS for Mac and the realm package. And even with the old version the error is still there.
I have updated a lot of other NuGet packages. What points me to Realm is the error message showing up the RealmObject class:
.../aon-digital-app.git/iOS/MTOUCH: Error MT2102: Error processing the method 'System.Void AonDigitalBroker.DBSettingsObjekt::set_Key(System.String)' in the assembly 'AonDigitalBroker.dll': Value cannot be null. (MT2102) (AonDigitalBroker.iOS)
public class DBSettingsObjekt : RealmObject { public string Key { get; set; } public string Value { get; set; }
public DBSettingsObjekt()
{
}
}
Sure I have updated a lot of other NuGet packages. But why should these updates influence and create this error in Realm inherited class ?
And even with the old project backup (without updates) and the old VS for Mac version I am getting this error. Might be a problem also (like the dynamic thing) on the Xamarin side.
I want to fix the problem to work on my customer project. Honestly I do not care where the error is located.
Best
Marco
I have enabled MTOUCH verbosity to get more details about the error. Here is the error with the StackTrace.
One thing, that I did find in the message:
warning MSB6002: The command-line for the "MTouch" task is too long. Command-lines longer than 32000 characters are likely to fail. Try reducing the length of the command-line by breaking down the call to "MTouch" into multiple calls with fewer parameters per call.
Here the StackTrace:
3[T1,T2,TResult] read) [0x00040] in <311724b4987d46ff81eafbc5bdc70a4e>:0 at Mono.Cecil.MethodDefinition.get_Body () [0x0002c] in <311724b4987d46ff81eafbc5bdc70a4e>:0 at Mono.Linker.Steps.MarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x0019c] in /Users/poupou/git/xamarin/xamarin-macios/external/linker/linker/Mono.Linker.Steps/MarkStep.cs:1275 at Xamarin.Linker.Steps.CoreMarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00060] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/CoreMarkStep.cs:171 at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x00023] in /Users/poupou/git/xamarin/xamarin-macios/external/linker/linker/Mono.Linker.Steps/MarkStep.cs:165 --- End of inner exception stack trace --- at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x00030] in /Users/poupou/git/xamarin/xamarin-macios/external/linker/linker/Mono.Linker.Steps/MarkStep.cs:167 at Mono.Linker.Steps.MarkStep.Process () [0x00019] in /Users/poupou/git/xamarin/xamarin-macios/external/linker/linker/Mono.Linker.Steps/MarkStep.cs:122 at Mono.Linker.Steps.MarkStep.Process (Mono.Linker.LinkContext context) [0x0000f] in /Users/poupou/git/xamarin/xamarin-macios/external/linker/linker/Mono.Linker.Steps/MarkStep.cs:67 at Xamarin.Linker.Steps.MobileMarkStep.Process (Mono.Linker.LinkContext context) [0x00001] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/MobileMarkStep.cs:36 at Xamarin.Linker.Steps.CoreMarkStep.Process (Mono.Linker.LinkContext context) [0x00017] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/CoreMarkStep.cs:26 at MonoTouch.Tuner.MonoTouchMarkStep.Process (Mono.Linker.LinkContext context) [0x0001d] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/MonoTouch.Tuner/MonoTouchMarkStep.cs:36 at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00023] in /Users/poupou/git/xamarin/xamarin-macios/external/linker/linker/Mono.Linker/Pipeline.cs:128 at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List
1[Mono.Cecil.AssemblyDefinition]& assemblies) [0x000e0] in /Users/poupou/git/xamarin/xamarin-macios/tools/mtouch/Tuning.cs:82 --- inner exception
System.ArgumentNullException: Value cannot be null.
Parameter name: instruction
at Mono.Cecil.Cil.InstructionOffset..ctor (Mono.Cecil.Cil.Instruction instruction) [0x00003] in <311724b4987d46ff81eafbc5bdc70a4e>:0
at Mono.Cecil.Cil.CodeReader.ReadScope (Mono.Cecil.Cil.ScopeDebugInformation scope) [0x00015] in <311724b4987d46ff81eafbc5bdc70a4e>:0
at Mono.Cecil.Cil.CodeReader.ReadDebugInfo () [0x0002a] in <311724b4987d46ff81eafbc5bdc70a4e>:0
at Mono.Cecil.Cil.CodeReader.ReadMethodBody () [0x00091] in <311724b4987d46ff81eafbc5bdc70a4e>:0
at Mono.Cecil.Cil.CodeReader.ReadMethodBody (Mono.Cecil.MethodDefinition method) [0x00014] in <311724b4987d46ff81eafbc5bdc70a4e>:0
at Mono.Cecil.MetadataReader.ReadMethodBody (Mono.Cecil.MethodDefinition method) [0x00000] in <311724b4987d46ff81eafbc5bdc70a4e>:0
at Mono.Cecil.MethodDefinition+<>c.<get_Body>b__41_0 (Mono.Cecil.MethodDefinition method, Mono.Cecil.MetadataReader reader) [0x00000] in <311724b4987d46ff81eafbc5bdc70a4e>:0
at Mono.Cecil.ModuleDefinition.Read[TItem,TRet] (TRet& variable, TItem item, System.Func`3[T1,T2,TResult] read) [0x00040] in <311724b4987d46ff81eafbc5bdc70a4e>:0
at Mono.Cecil.MethodDefinition.get_Body () [0x0002c] in <311724b4987d46ff81eafbc5bdc70a4e>:0
at Mono.Linker.Steps.MarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x0019c] in /Users/poupou/git/xamarin/xamarin-macios/external/linker/linker/Mono.Linker.Steps/MarkStep.cs:1275
at Xamarin.Linker.Steps.CoreMarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00060] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/CoreMarkStep.cs:171
at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x00023] in /Users/poupou/git/xamarin/xamarin-macios/external/linker/linker/Mono.Linker.Steps/MarkStep.cs:165
---
at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List`1[Mono.Cecil.AssemblyDefinition]& assemblies) [0x00145] in /Users/poupou/git/xamarin/xamarin-macios/tools/mtouch/Tuning.cs:94
at Xamarin.Bundler.Target.LinkAssemblies (System.Collections.Generic.List`1[Mono.Cecil.AssemblyDefinition]& assemblies, System.String output_dir, System.Collections.Generic.IEnumerable`1[T] sharedCodeTargets) [0x0029a] in /Users/poupou/git/xamarin/xamarin-macios/tools/mtouch/Target.cs:491
at Xamarin.Bundler.Target.ManagedLink () [0x005c5] in /Users/poupou/git/xamarin/xamarin-macios/tools/mtouch/Target.cs:614
at Xamarin.Bundler.Target.ProcessAssemblies () [0x000bb] in /Users/poupou/git/xamarin/xamarin-macios/tools/mtouch/Target.cs:800
at Xamarin.Bundler.Application.ProcessAssemblies () [0x0002f] in /Users/poupou/git/xamarin/xamarin-macios/tools/mtouch/Application.cs:1396
at Xamarin.Bundler.Application.BuildManaged () [0x00001] in /Users/poupou/git/xamarin/xamarin-macios/tools/mtouch/Application.cs:827
at Xamarin.Bundler.Application+<>c.<BuildAll>b__134_1 (Xamarin.Bundler.Application v) [0x00000] in /Users/poupou/git/xamarin/xamarin-macios/tools/mtouch/Application.cs:775
at System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) [0x00024] in <c9f8153c41de4f8cbafd0e32f9bf6b28>:0
at Xamarin.Bundler.Application.BuildAll () [0x00050] in /Users/poupou/git/xamarin/xamarin-macios/tools/mtouch/Application.cs:775
at Xamarin.Bundler.Driver.Main2 (System.String[] args) [0x00481] in /Users/poupou/git/xamarin/xamarin-macios/tools/mtouch/mtouch.cs:1420
at Xamarin.Bundler.Driver.Main (System.String[] args) [0x0000f] in /Users/poupou/git/xamarin/xamarin-macios/tools/mtouch/mtouch.cs:945
Done building target "_CompileToNative" in project "AonDigitalBroker.iOS.csproj" -- FAILED.
Best
Marco
Hey @marcoseraphin,
Looking at the MTouch stack trace it seems that it's having some trouble reading debug information in the assembly. Does this also happen if you build for Release? Also, could you try disabling the Xamarin.iOS Linker in the project's iOS Build property sheet?
It would also help us look at the assembly file so would you mind sending it to help@realm.io?
Hi fealebenpae,
thanx for your help.
If I switch to iOS release I did NOT get the error. Also if I change the Link behavior to "Don't link" obviously the error also does NOT occur. The error occurs when setting the Link behavior to "Link Framework SDKs Only".
I will help you as much as I can. What do you need to eMail you to help@realm.io?
The binary assembly file ? Or source code ? Please keep in mind that I am working as a Xamarin freelancer for a big customer in the insurance business. So I could not provide the complete code.
But I could send you the binary or some Realm related classes as source code.
Best
Marco
Only the assembly, please. According to the MTouch log, it is located at /Users/marcoseraphin/Desktop/AON-App/GitHub/saschafink/aon-digital-app.git/AonDigitalBroker/bin/Debug/AonDigitalBroker.dll
. I want to run it through Mono.Cecil with a debugger attached and see what's causing it to fail.
Hi fealebenpae,
yep...I send the assembly binary file and the .config and .pdb file to help@realm.io.
Thank you
Marco
@marcoseraphin I tried to open the assembly using the Mono.Cecil built from source from the Xamarin.iOS 10.12.0.18 release, but I couldn't reproduce the error. I also looked at the disassembly of the offending AonDigitalBroker.DBSettingsObjekt::set_Key(System.String)
method and it looks fine. Since we can't reproduce the error in a clean project I think that something else in your environment is also affecting MTouch.
Ideally we'd prefer the smallest possible reproduction project, but... What I propose instead is that you make a copy of your solution folder, remove all source code and assets from it and zip everything else - the NuGet packages
folder and the bin
and obj
folders of every project that's referenced by the iOS App project are essential. You can then upload the archive to Dropbox or Google Drive or any other file locker that you prefer and send the link to help@realm.io. What I want to do is to build MTouch from source and run it on the project and try to debug the error but in order to do so I will need all the inputs that MTouch takes.
I'm afraid I can't offer much help without being able to reproduce the error. If you can't provide a repro all I can suggest is trying to tweak the "Debug information" build setting or adding --linkskip=AonDigitalBroker.dll
to the MTouch flags so it doesn't attempt to process that assembly.
I will send you an DropBox link of the zipped project without the source and resources files.
Perhaps interesting:
Compiling the Android projects I do get a similar error (Mono linker MarkException, Mono.Cecil.REsolutionException...
In this case NOT realm seems to be the source, but an NuGet package names Acr.UserDialogs.dll (I am referencing version 6.4.1, NOT the current version 6.5.1) => https://www.nuget.org/packages/Acr.UserDialogs/
I did NOT update this package, because the actual version already supports .Net Standard which the rest of my project and many other packages did not.
Here the error message with StackTrace:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(5,5): Error MSB4018: The "LinkAssemblies" task failed unexpectedly.
Mono.Linker.MarkException: Error processing method: 'Android.App.Dialog Acr.UserDialogs.Fragments.BottomSheetDialogFragment::CreateDialog(Acr.UserDialogs.ActionSheetConfig)' in assembly: 'Acr.UserDialogs.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve Android.Support.Design.Widget.BottomSheetDialog
at Mono.Linker.Steps.MarkStep.HandleUnresolvedType (Mono.Cecil.TypeReference reference) [0x00006] in
Also here I just can only compile if I set the linker option to "Don't link", as in the iOS project.
Best
Marco
Hey @marcoseraphin,
Unfortunately I haven't had time to debug the Xamarin linker yet, but I believe the newest Xamarin.iOS release - 10.12.0.20, might have a fix for this issue, specifically https://bugzilla.xamarin.com/show_bug.cgi?id=58834. Could you please try updating Xamarin.iOS and see if it helps?
Hi,
yes......I installed the new stable update for Xamarin.iOS 10.12.0.20 and as noted in the release notes the MTOUCH error is gone even if I set the linker option to "Link Framework SDKs only".
So it was not your fault or an error in the Realm package as wrote before. It was an error in Xamarin.
So thank you very much for your help. I still get the linker in my Android project...I have to see and made some changes in the Android NuGet packages.
Best and thanks for your time and help
Marco
Hmmm I'm not getting this on Android, I'm getting something similar on iOS. I have my plight documented here:
https://stackoverflow.com/q/47913283/1060314
It boils down to these 2 MTOUCH build errors.
MTOUCH : error MT2101: Can't resolve the reference 'System.Void* System.Runtime.CompilerServices.Unsafe::AsPointer(!!0&)', referenced from the method 'T Realms.MarshaledVector`1::MarshalElement(System.Int32)' in 'System.Runtime.CompilerServices.Unsafe, Version=4.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
MTOUCH : error MT2101: Can't resolve the reference 'System.Void System.Runtime.CompilerServices.Unsafe::AsPointer(!!0&)', referenced from the method 'T Realms.MarshaledVector1::MarshalElement(System.Int32)' in 'System.Runtime.CompilerServices.Unsafe, Version=4.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Error processing method: 'T Realms.MarshaledVector1::MarshalElement(System.Int32)' in assembly: 'Realm.dll' Failed to resolve System.Void System.Runtime.CompilerServices.Unsafe::AsPointer(!!0&)
I can't tell if it's Realm or if it's me. I stripped everything out of my project and still get that build error. Next I am going to try removing all my Nuget Packages and see if that does anything differently.
Well, I just deleted all my packages and re-installed them and it seems to fix the issue ¯_(ツ)_/¯
https://stackoverflow.com/a/47926447/1060314
Good ol' Xamarin!
Hi,
after updating VisualStudio for Mac (stable channel) to Version 7.1 (build 1297) I am getting the following error from MTOUCH on the Mac.
..../iOS/MTOUCH: Error MT2102: Error processing the method 'System.Void AonDigitalBroker.DBSettingsObjekt::set_Key(System.String)' in the assembly 'AonDigitalBroker.dll': Value cannot be null. (MT2102) (AonDigitalBroker.iOS)
I have a simple RealmObject class:
public class DBSettingsObjekt : RealmObject { public string Key { get; set; } public string Value { get; set; }
I am using Realm database version 1.6.0 for Xamarin (Forms).
The Xamarin.Forms App do work without no problem on Android and in Release mode on iOS, BUT when I compile in iOS debug mode I get the arrow above.
I have to say that I have replaced the MTOUCH.EXE concerning this bug:
https://bugzilla.xamarin.com/show_bug.cgi?id=58789
Because otherhwiese I just a a unspecified MT0000 error from MTOUCH.
Any ideas how to solve the problem ?
Thanx in advance
Marco
Goals
Expected Results
Actual Results
Steps to Reproduce
Code Sample
Version of Realm and Tooling
Logs
systemctl status realm-object-server.service
Paste output here
sudo journalctl -u realm-object-server.service
Paste output here
cat /var/log/realm-object-server.log
Paste output here