-
Type: Bug
-
Resolution: Cannot Reproduce
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
<!--- Questions: If you have questions about how to use Realm, please ask on -->
<!--- StackOverflow: http://stackoverflow.com/questions/ask?tags=realm -->
<!--- We monitor the
realm
tag. -->
<!--- Feature Request: Just fill in the first two sections below. -->
<!--- Bugs: To help you as fast as possible with an issue please describe your issue -->
<!--- and the steps you have taken to reproduce it in as much detail as possible. -->
<Unable to render embedded object: File (--- Thanks for helping us help you) not found. -->
Goals
<!--- What are you trying to achieve? -->
We're using Realm as basis for our logging platform. The application we develop is a Xamarin.Native android app. One of the requirements is that fatal crashes should be logged to realm as well. Thus, we subscribe for unhandled exceptions and whenever a fatal exception occurs, we try to log it inside Realm.
Here's the code which subscribes to fatal exceptions
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
And here's the piece that handles it
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { var crashFilePath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData), "Logs.realm"); using (var realm = Realm.GetInstance(new RealmConfiguration(crashFilePath))) using (Transaction tx = realm.BeginWrite()) { realm.Add(new RealmLogMessage { Message = (e.ExceptionObject as Exception)?.ToString() }); tx.Commit(); } }
However, on the line where I do
Realm.GetInstance(new RealmConfiguration(crashFilePath)))
the application crashes with no feedback why.
I tried to write a file to that same location and it worked. I'm not sure why the issue is with realm, and Realm can't write the file when application is in this state.
Expected Results
<!--- What did you expect to happen? -->
I expect RealmLogMessage to be inserted into the database successfully
Actual Results
<!--- What happened instead? -->
<!--- e.g. the stack trace of a crash -->
Instead application crashes
Steps to Reproduce
<!--- What are steps we can follow to reproduce this issue? -->
- Launch the sample app
- Press the button
- Application crashes
- Unhandled exception event raised
- App quits
- Relaunch the app
- Observe that
Realm.All<RealmLogMessage>()
returns nothing
Code Sample
<!--- Please provide a code sample or test case that highlights the issue. -->
<!--- If relevant, include your model definitions. -->
<!--- For larger code samples, links to external gists/repositories are preferred. -->
<!--- Alternatively, you can share information confidentially via email at help@realm.io. -->
<Unable to render embedded object: File (--- Full projects that we can compile and run ourselves are ideal) not found. -->
Version of Realm and Tooling
- Server OS & Version: ? (e.g. CentOS 6)
- Client SDK Version: Realm .NET 3.2.1
- Client OS & Version: Mac OS 10.14 (18A391)
=== Visual Studio Community 2017 for Mac ===
Version 7.6.10 (build 27)
Installation UUID: 21f35cb0-ffca-4f2b-b96d-fc41cb3325af
Runtime:
Mono 5.12.0.309 (2018-02/39d89a335c8) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)
Package version: 512000309
=== NuGet ===
Version: 4.3.1.4445
=== .NET Core ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
2.1.2
2.1.1
2.0.5
SDK: /usr/local/share/dotnet/sdk/2.1.302/Sdks
SDK Versions:
2.1.302
2.1.301
2.1.4
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.12.0/lib/mono/msbuild/15.0/bin/Sdks
=== Xamarin.Profiler ===
Version: 1.6.3
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Apple Developer Tools ===
Xcode 10.0 (14320.25)
Build 10A255
=== Xamarin.Mac ===
Version: 5.0.0.0 (Visual Studio Community)
Hash: b40230c0
Branch:
Build date: 2018-09-27 11:41:37-0400
=== Xamarin.iOS ===
Version: 12.0.0.15 (Visual Studio Community)
Hash: 84552a46
Branch: xcode10
Build date: 2018-09-17 21:54:33-0400
=== Xamarin.Android ===
Version: 9.0.0.20 (Visual Studio Community)
Android SDK: /Users/gagik/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
6.0 (API level 23)
7.0 (API level 24)
7.1 (API level 25)
8.0 (API level 26)
8.1 (API level 27)
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 27.0.1
SDK Build Tools Version: 28.0.0
Java SDK: /usr
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Xamarin Inspector ===
Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1
=== Build Information ===
Release ID: 706100027
Git revision: 94dbd4d35daaa5a2ff6a51c3fd5cbb2308bd83ea
Build date: 2018-10-18 16:34:31+00
Build branch: release-7.6
Xamarin extensions: 3a9afc960ba73e5862829e8a0cd9369bcca43d70
=== Operating System ===
Mac OS X 10.14.0
Darwin 18.0.0 Darwin Kernel Version 18.0.0
Wed Aug 22 20:13:40 PDT 2018
root:xnu-4903.201.2~1/RELEASE_X86_64 x86_64
=== Enabled user installed extensions ===
NuGet Package Explorer 0.2
NuGet Package Management Extensions 0.12.6
Straight8's SpecFlow Intergration 1.11.0.0
Internet of Things (IoT) development (Preview) 7.5