Closed jpsim closed 8 years ago
Hi @jerryno6, it would really help us diagnose this crash if you could give us some more information such as the Xamarin.Android version you are running and the version of Xamarin Studio or Visual Studio you're running.
Also, it would be great if you could post a gist with your RealmObject
classes, or better yet if you could prepare a small repro project that demonstrates this issue.
Thanks!
I have just the same issue. While in debug mode everything is working fine, but once in release mode - it crashing just there on GetInstance( Realms.RealmConfiguration.DefaultConfiguration );
Running/Testing on Huawei Mediapad X2, Zopo ZP950, Huawei Y625, Samsung Galaxy s6, Samsung Galaxy S7 edge.
Realm version : 0.74.1.0 Android Compiler SDK config : Compile API level 22, Minimum Android target : API level 15.
I suspect lack of privileges to write in specific folders maybe leading to exception on the database creation maybe. ( not quite sure yet )
@YordanYanakiev please give us more information or sample code. I just built a tiny Android sample from scratch to re-check the NuGet and it works fine in Release mode.
using Android.App;
using Android.Widget;
using Android.OS;
using Realms;
namespace TestRealmRelease0
{
class RT : RealmObject {
public string Name {get;set;}
public int Age { get; set; }
};
[Activity (Label = "TestRealmRelease", MainLauncher = true, Icon = "@mipmap/icon")]
public class MainActivity : Activity
{
int count = 1;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button> (Resource.Id.myButton);
button.Click += delegate {
using (var r = Realm.GetInstance(Realms.RealmConfiguration.DefaultConfiguration)) {
r.Write(() => {
var obj = r.CreateObject<RT>();
obj.Name = $"Name{count}";
obj.Age = 42 + count;
});
button.Text = string.Format ("{0} clicks! and {1} objects", count++, r.All<RT>().Count());
}
};
}
}
}
Hi @fealebenpae i just create new project and install the realm nuget into it, then i declare
var freshRealm = Realm.GetInstance();
to test the database creating and it throw exception at this line. Below is the software informations:
Visual Studio 2015 Xamarin 4.0.0.1717 Xamarin.Android 6.0.0.35
Project type : Native Portabel ( not Forms ). Please rename the DOCX to ZIP, because seems like github rejecting it.. by some reason unknown... RDB2.DOCX
OK, got it unpacked and looking at it now (over dinner in Western Australia).
I can upload a ready APK if this will help.
I have replicated this but don't yet understand why it is happening.
It is not related to
new Dog
instead of realm.CreateObject<Dog>()
OnCreate
(I wondered if that was too early) - putting it in the Button .Click made no difference)Dog
from Person
Actually I believe that it is happen right at the : Realm.GetInstance(Realms.RealmConfiguration.DefaultConfiguration); but while var r = Realms.RealmConfiguration.DefaultConfiguration; would pass but here : var k = Realm.GetInstance(); or k = Realm.GetInstance( r ); - will crash.
Therefore it might be something inside GetInstance().. and while in debug the user have mode simulated rights and it might be inside different folder - the things does not stay like this for release. ( maybe )
I wonder if the configuration receive a store folder which for sure is accessible - what would be the results.. ( worth to give a try maybe ).
Crash in both debug mode and release mode :( Here is the source code i tested, it is as simple as your example code https://realm.io/docs/xamarin/latest/
using System;
using System.Linq;
using Android.App;
using Android.Widget;
using Android.OS;
using Realms;
namespace TestRealm
{
[Activity(Label = "TestRealm", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
public class Dog : RealmObject
{
public string Name { get; set; }
public int Age { get; set; }
}
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
var button = FindViewById<Button>(Resource.Id.MyButton);
button.Click += Button_Click;
}
private void Button_Click(object sender, EventArgs e)
{
try
{
//create new database
var realm = Realm.GetInstance(); //Crash Here
//save data
realm.Write(() =>
{
var mydog = realm.CreateObject<Dog>();
mydog.Name = "Rex";
mydog.Age = 1;
});
//get data
var oldDogs = from d in realm.All<Dog>() where d.Age > 8 select d;
}
catch (Exception ex)
{
Toast.MakeText(this, "Crash", ToastLength.Short).Show();
}
}
}
}
Progress!
This is definitely an error in the Fody weaving. I have added better error handling in Realm.CreateRealmObjectMetadata
which is being invoked (via LINQ) when you call GetInstance
. It's part of the internal schema construction which occurs at runtime.
So now you will get a better diagnostic exception than the NullReferenceException
. You get an ArgumentException
with a message like The class RDB2.Dog has not been woven with Fody.
I am still trying to work out why Fody is not weaving this code and provide better diagnostics for that failure.
Cool, I hope you can fix this next month.
:( next month :( Sounds like a quite a lot to be fixed :|
OK, I have a fix but not (yet) a why.
The problem with the Fody weaving is that it is not being invoked for the Droid project.
When you look at the build log for RDB2.Droid.csproj
you will see the line:
warning : Target 'FodyTarget', not found in the project
Looking inside RBD2.Droid.csproj
you can see a line:
<Import Project="..\..\packages\Realm.0.74.1\build\Realm.targets" Condition="Exists('..\..\packages\Realm.0.74.1\build\Realm.targets')" />
What is missing is a companion import:
<Import Project="..\..\packages\Fody.1.29.4\build\portable-net+sl+win+wpa+wp\Fody.targets" Condition="Exists('..\..\packages\Fody.1.29.4\build\portable-net+sl+win+wpa+wp\Fody.targets')" />
This import of Fody.targets
is inserted by adding the NuGet package and is the magic bit which causes Fody to be invoked for your project.
Without it, Fody isn't invoked, your RealmObject
subclasses aren't woven and then GetInstance
crashes with a NullReferenceException
because there aren't any classes in the Realm.
So, the fix for you is simply to copy and paste the import of Fody.targets
.
Note if you are doing this on other projects to be careful with the relative path to your packages
directory as varies for multi-platform solutions. It will be either one or two levels up.
What would help a lot with this issue is if anyone runs into it, after confirming that Fody.targets
is missing from your project, try to note for us exactly how you did the NuGet install.
I'm working on a theory that it is related to which IDE is used possibly in combination with timing of adding packages.
I've just right click on the PCL Solution, then Manage Nuget Packages for Solution, and then search for Realms and click Install.. That's it.
@YordanYanakiev can you think of anything else about what you did creating this project. I can't replicate the failure to add the Fody import line in the Droid project.
What was the full path of your project?
Ironically, this is not a failure of the Realm package - it is a failure of the Fody package being pulled down from NuGet by our dependency on it. However, the fact that it added FodyWeavers.xml
to RDB2.Droid.csproj
is what's really confusing - it made a partial change to the project! That partial change means a successful write to the project so it is like some portion of the Fody installer failed, not a write permission error.
I think my next step will be to dig a bit deeper into how Fody's nuget package works and see if there's anything different about how it adds FodyWeaver.xml
to the projectt vs how it adds the import...Fody.targets
line.
@jerryno6 can you please confirm your problem is due to a lack of the Import...Fody.targets
in your .csproj
as detailed above
Note that a branch was merged with a PR to provide better diagnostic exceptions to help with this problem.
That will be in the next Realm release but we still don't have a cause identified for the problem.
Thanks AndyDentFree !
I've just create new project, install Realm 0.74.1, and i see the Import...Fody.targets
in my .csproj.
Now the database creation is OK, but i have another crash.
``` public static string DBFilePath
{
get
{
string path = Path.Combine(AppFolder, "database.realm");
return path;
}
}
```public static string AppFolder
{
get
{
var packageCode = "DemoRealm1";
var firstPath = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;
string path = Path.Combine(firstPath, packageCode);
return CreateDirectoryIfNotExists(path);
}
}
It crash when i use this code:
```var appDirectory = AppConstants.AppFolder;
string dbpath = AppConstants.DBFilePath;
RealmConfiguration cfg = new RealmConfiguration(appDirectory);
//it still crash when I use dbpath var realm = Realm.GetInstance(cfg);```
It is ok if i use this code, but i cannot get the database file path from the sdcard, it always return the default path. I always connect the tablet to PC, and copy files from tablet to PC.
```string dbpath = AppConstants.DBFilePath;
RealmConfiguration cfg = new RealmConfiguration();
cfg.ConfigWithPath(dbpath);
var realm = Realm.GetInstance(cfg); ```
Hi Team,
I run into same situation. I get the same exact exception when call Realm,GetInstance() is release build. This is the stack trace I get.
Error Message: Value cannot be null.
Parameter name: type
StackTrace: at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00006] in <filename unknown>:0
at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0
at Realms.Realm.CreateRealmObjectMetadata (System.Type realmObjectType) [0x0001e] in <filename unknown>:0
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement] (IEnumerable`1 source, System.Func`2 keySelector, System.Func`2 elementSelector, IEqualityComparer`1 comparer) [0x00055] in <filename unknown>:0
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement] (IEnumerable`1 source, System.Func`2 keySelector, System.Func`2 elementSelector) [0x00000] in <filename unknown>:0
at Realms.Realm..ctor (Realms.SharedRealmHandle sharedRealmHandle, Realms.RealmConfiguration config) [0x00037] in <filename unknown>:0
at Realms.Realm.GetInstance (Realms.RealmConfiguration config) [0x00171] in <filename unknown>:0
at NottieBear.EaseAssist.Util.RealmUtil.Open () [0x00000] in <filename unknown>:0
at NottieBear.EaseAssist.Util.AppRealmDataBuilder.InitializeData () [0x00000] in <filename unknown>:0
at NottieBear.EaseAssist.Droid.SplashActivity.<OnResume>b__1_0 () [0x0001e] in <filename unknown>:0
at System.Threading.Tasks.Task.InnerInvoke () [0x00012] in <filename unknown>:0
at System.Threading.Tasks.Task.Execute () [0x00016] in <filename unknown>:0
So I double check my Project file settings, this what i have in Droid.csproj
<Import Project="..\packages\Realm.0.74.1\build\Realm.targets" Condition="Exists('..\packages\Realm.0.74.1\build\Realm.targets')" />
then my portable project settings
and also I confirm that "FodyWeavers.xml" is include in these 2 project with the follownig content
<?xml version="1.0" encoding="utf-8"?>
So what I could do continue from here to solve the problem? Anything else I may miss out? Thanks.
@jerryno6 have spun off #554 as a new issue for sdcard problems.
@NottieBear can you please provide some source, at least the class declarations. It seems from your comprehensive report that the Fody setup is all there. I have pushed a PR that's been accepted into master which provides better debugging of the Fody failure at least identifying the problem with a more meaningful exception than the NullReferenceError
.
If you look at the build output you may see messages from Fody which provide more feedback.
Hi,
I upload my solution which you could repro the same issue.
Basically, in PCL, myclass.cs
using System;
namespace NottieBear.EaseAssist
{
public class MyClass
{
public MyClass() { }
public Realms.Realm Open()
{
return Realms.Realm.GetInstance();
}
}
public class rlmAppDataVersion : Realms.RealmObject
{
public int Version { get; set; }
}
}
MainActivity.cs
namespace NottieBear.EaseAssist.Droid
{
[Activity(Label = "NottieBear.EaseAssist.Droid", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
int count = 1;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.myButton);
button.Click += delegate
{
button.Text = string.Format("{0} clicks!", count++);
};
try
{
Realms.Realm realm = new MyClass().Open();
}
catch (AggregateException ae)
{
StringBuilder sb = new StringBuilder();
foreach (var innerException in ae.Flatten().InnerExceptions)
{
sb.AppendLine("Error Message: " + innerException.Message);
sb.AppendLine("StackTrace: " + innerException.StackTrace);
sb.AppendLine();
}
Toast.MakeText(this, sb.ToString(), ToastLength.Long);
}
}
}
}
Build Output
1>------ Build started: Project: NottieBear.EaseAssist, Configuration: Release Any CPU ------
1> Fody: Fody (version 1.29.4.0) Executing
1> Fody: Finished Fody 1059ms.
1> NottieBear.EaseAssist -> C:\Users\ducky\Desktop\EasecoxAssistant\NottieBear.EaseAssist\bin\Release\NottieBear.EaseAssist.dll
1> Fody: Skipped Verifying assembly since it is disabled in configuration
1> Fody: Finished verification in 2ms.
2>------ Build started: Project: NottieBear.EaseAssist.Droid, Configuration: Release Any CPU ------
2>C:\Users\ducky\Desktop\EasecoxAssistant\NottieBear.EaseAssist.Android\FodyWeavers.xml : warning XA0101: @(Content) build action is not supported
2> Processing: obj\Release\res\layout\main.xml
2> Processing: obj\Release\res\values\strings.xml
2> Fody: Fody (version 1.29.4.0) Executing
2> Fody: Finished Fody 206ms.
2> NottieBear.EaseAssist.Droid -> C:\Users\ducky\Desktop\EasecoxAssistant\NottieBear.EaseAssist.Android\bin\Release\NottieBear.EaseAssist.Droid.dll
2> Fody: Skipped Verifying assembly since it is disabled in configuration
2> Fody: Finished verification in 0ms.
2> Processing: obj\Release\res\layout\main.xml
2> Processing: obj\Release\res\values\strings.xml
2> Processing: obj\Release\res\layout\main.xml
2> Processing: obj\Release\res\values\strings.xml
3>Starting deploy a[K[Dav[K[D[Davd[K[D[D[Davd [K[D[D[D[Davd n[K[D[D[D[D[Davd na[K[D[D[D[D[D[Davd nam[K[D[D[D[D[D[D[Davd name[K ...
3>Deploying a[K[Dav[K[D[Davd[K[D[D[Davd [K[D[D[D[Davd n[K[D[D[D[D[Davd na[K[D[D[D[D[D[Davd nam[K[D[D[D[D[D[D[Davd name[K ...
3>Build started.
3>@(Content) build action is not supported
3>C:\Program Files (x86)\MSBuild\14.0\bin\csc.exe /noconfig /nowarn:1701,1702,2008 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;__XAMARIN_ANDROID_v1_0__;__MOBILE__;__ANDROID__;__ANDROID_1__;__ANDROID_2__;__ANDROID_3__;__ANDROID_4__;__ANDROID_5__;__ANDROID_6__;__ANDROID_7__;__ANDROID_8__;__ANDROID_9__;__ANDROID_10__;__ANDROID_11__;__ANDROID_12__;__ANDROID_13__;__ANDROID_14__;__ANDROID_15__;__ANDROID_16__;__ANDROID_17__;__ANDROID_18__;__ANDROID_19__;__ANDROID_20__;__ANDROID_21__ /errorendlocation /preferreduilang:en-US /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v5.0\Mono.Android.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll" /reference:C:\Users\ducky\Desktop\EasecoxAssistant\NottieBear.EaseAssist\bin\Release\NottieBear.EaseAssist.dll /reference:C:\Users\ducky\Desktop\EasecoxAssistant\packages\Realm.0.74.1\lib\MonoAndroid44\Realm.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Collections.Concurrent.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Collections.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.ComponentModel.Annotations.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.ComponentModel.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.ComponentModel.EventBasedAsync.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Diagnostics.Contracts.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Diagnostics.Debug.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Diagnostics.Tools.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Diagnostics.Tracing.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Dynamic.Runtime.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Globalization.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.IO.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Linq.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Linq.Expressions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Linq.Parallel.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Linq.Queryable.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Net.NetworkInformation.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Net.Primitives.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Net.Requests.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.ObjectModel.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Reflection.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Reflection.Emit.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Reflection.Emit.ILGeneration.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Reflection.Emit.Lightweight.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Reflection.Extensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Reflection.Primitives.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Resources.ResourceManager.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Runtime.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Runtime.Extensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Runtime.InteropServices.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Runtime.InteropServices.WindowsRuntime.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Runtime.Numerics.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Runtime.Serialization.Json.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Runtime.Serialization.Primitives.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Runtime.Serialization.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Security.Principal.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.ServiceModel.Http.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.ServiceModel.Primitives.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.ServiceModel.Security.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Text.Encoding.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Text.Encoding.Extensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Text.RegularExpressions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Threading.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Threading.Tasks.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Threading.Tasks.Parallel.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Threading.Timer.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Xml.ReaderWriter.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Xml.XDocument.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Xml.XmlSerializer.dll" /debug- /debug:full /optimize- /out:obj\Release\NottieBear.EaseAssist.Droid.dll /ruleset:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\\Rule Sets\MinimumRecommendedRules.ruleset" /target:library /utf8output MainActivity.cs Resources\Resource.designer.cs Properties\AssemblyInfo.cs "C:\Users\ducky\AppData\Local\Temp\MonoAndroid,Version=v5.0.AssemblyAttributes.cs" obj\Release\\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs obj\Release\\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs obj\Release\\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
3> Fody: Fody (version 1.29.4.0) Executing
3> Fody: Finished Fody 149ms.
3>NottieBear.EaseAssist.Droid -> C:\Users\ducky\Desktop\EasecoxAssistant\NottieBear.EaseAssist.Android\bin\Release\NottieBear.EaseAssist.Droid.dll
3> Fody: Skipped Verifying assembly since it is disabled in configuration
3> Fody: Finished verification in 0ms.
3> Processing: obj\Release\res\layout\main.xml
3> Processing: obj\Release\res\values\strings.xml
3>C:\Program Files (x86)\Java\jdk1.7.0_55\\bin\keytool.exe -list -alias androiddebugkey -storepass android -keypass android -keystore "C:\Users\ducky\AppData\Local\Xamarin\Mono for Android\debug.keystore"
3>C:\Program Files (x86)\Java\jdk1.7.0_55\\bin\jarsigner.exe -keystore "C:\Users\ducky\AppData\Local\Xamarin\Mono for Android\debug.keystore" -storepass android -keypass android -digestalg SHA1 -sigalg md5withRSA -signedjar bin\Release\\NottieBear.EaseAssist-Signed-Unaligned.apk C:\Users\ducky\Desktop\EasecoxAssistant\NottieBear.EaseAssist.Android\obj\Release\android\bin\NottieBear.EaseAssist.apk androiddebugkey
3>No -tsa or -tsacert is provided and this jar is not timestamped. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (2046-05-07) or after any future revocation date.
3>C:\Program Files (x86)\Android\android-sdk\build-tools\23.0.3\zipalign.exe 4 "C:\Users\ducky\Desktop\EasecoxAssistant\NottieBear.EaseAssist.Android\bin\Release\NottieBear.EaseAssist-Signed-Unaligned.apk" "bin\Release\\NottieBear.EaseAssist-Signed.apk"
3>Build succeeded.
3>Deploy successfully on a[K[Dav[K[D[Davd[K[D[D[Davd [K[D[D[D[Davd n[K[D[D[D[D[Davd na[K[D[D[D[D[D[Davd nam[K[D[D[D[D[D[D[Davd name[K
========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========
Thanks.
@NottieBear thanks - I have downloaded and built and run your zipped EasecoxAssistant.zip
fine on OS X with Xamarin Studio 6 and on Windows 10 with VS2015 :-(
Can you please try just deleting the contents of your Packages
directory and see if restoring packages makes it work? That's one obvious difference between my setup and yours. Otherwise we have to try to dig deeper into system or IDE settings.
I'm frankly confused - your path seems nice and conservative from the log above (short and no spaces).
@AndyDentFree - I deleted and restored packages..... but no luck for me.... still at the same problem...
So I recreate a new Android Solution without Portable Project.. Realm work for me without any problem... but once I add a new portable project it show me the same exception...
I try and see what else I could do....
Note: the debug build work fine Just Release Build give me problem
Thanks...
Microsoft Visual Studio Community 2015
Version 14.0.25123.00 Update 2
Microsoft .NET Framework
Version 4.6.01038
Installed Version: Community
Visual Basic 2015 00322-20000-00000-AA097
Microsoft Visual Basic 2015
Visual C# 2015 00322-20000-00000-AA097
Microsoft Visual C# 2015
Visual C++ 2015 00322-20000-00000-AA097
Microsoft Visual C++ 2015
Windows Phone SDK 8.0 - ENU 00322-20000-00000-AA097
Windows Phone SDK 8.0 - ENU
.NET Reflector Visual Studio Extension 9.0.1.374
Integrates .NET Reflector into Visual Studio to allow you to seamlessly debug into third-party code and assemblies, even if you don't have the source code for them.
Visit www.reflector.net for more information.
Copyright (c) 2009-2012 Red Gate Software Inc.
Application Insights Tools for Visual Studio Package 5.206.60517.2
Application Insights Tools for Visual Studio
ASP.NET and Web Tools 2015.1 (Beta8) 14.1.11106.0
ASP.NET and Web Tools 2015.1 (Beta8)
ASP.NET Web Frameworks and Tools 2012.2 4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563
ASP.NET Web Frameworks and Tools 2013 5.2.40314.0
For additional information, visit http://www.asp.net/
Common Azure Tools 1.7
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
JavaScript Language Service 2.0
JavaScript Language Service
JavaScript Project System 2.0
JavaScript Project System
Microsoft Azure Mobile Services Tools 1.4
Microsoft Azure Mobile Services Tools
NuGet Package Manager 3.4.3
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
PreEmptive Analytics Visualizer 1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.
SQL Server Compact & SQLite Toolbox 4.6.0
SQL Server Compact & SQLite Toolbox adds scripting, import, export, rename, query execution and much more to SQL Server Compact & SQLite Data Connections.
SQL Server Data Tools 14.0.60311.1
Microsoft SQL Server Data Tools
TypeScript 1.8.31.0
TypeScript tools for Visual Studio
Visual Studio Tools for Universal Windows Apps 14.0.25219.00
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.
VisualSVN 5.1.4
Integration with Subversion version control. For more information about VisualSVN, see the VisualSVN website at http://www.visualsvn.com
Copyright © 2005-2016 VisualSVN Ltd. All rights reserved.
Xamarin 4.0.4.4 (a9c7826)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin.Android 6.0.4.0 (ee215fc)
Visual Studio plugin to enable development for Xamarin.Android.
Xamarin.iOS 9.6.2.2 (be25da5)
Visual Studio extension to enable development for Xamarin.iOS.
Hi Update from my finding.
I able to download a workable sample over here - Simple
After some play around with the sample... i able to make it work under release build... which is by wrapping my RealmObject inside a class... like this
public class MyClass
{
public class rlmAppDataVersion : Realms.RealmObject
{
public int Version { get; set; }
}
}
Any opinion? Thanks
@NottieBear I think the fact of it appearing to work after wrapping is a false trail - wrapping should have no meaning.
What may be making it work is something about it triggering a rebuild or some other coincidece.
Was there a time when you didn't have any descendants from RealmObject? That would cause the crash.
I will get one of the other guys to check as my VS install is on the Alpha channel and so has much later Xamarin versions than you but that seems unlikely to cause such a fundamental crash.
Further note that at least one other team member here at Realm has replicated the utterly weird syndrome of the Fody weaving working within a nested class but not outside it, directly contradicting my experience but matching @NottieBear.
Puzzled exploration is continuing.
@NottieBear, as @AndyDentFree noted, I am able to reproduce your issue here. It seems to be related to some framework code that is being stripped by the linker. If you change your project linker settings to "none", it seems to help. I will figure out how to solve this so it wont be necessary.
@AndyDentFree @kristiandupont Thanks for the help... it working now as I change the linker settings to "none".
confirmed. Seems like switching "Linking" to "None" plays the trick. Really annoying bug :|
Closing this long-running issue now we have narrowed it down to the Fody issue covered by #574 and improved the error reporting.
It's repaired in the current build ?
The problems which were leading to a crash all seemed to be related to the occasional Fody problems and people using Linking. Hence the desire to have a more focused issue rather than leaving this open which looks too generic and tends to catch anyone with a crash. I have also just added #577 to cover the other issues identified in this thread.
Just to note on "NottieBear" comment. I've just tested his solution - it does not fixing the issue for me. Practically I cant go release build since without linking my result app is nearly 60 MB for just a simple slide. It's a no-go situation :|
Cross-posted from realm/realm-cocoa#3574: