We're using Xamarin and Xamarin Forms on a daily basis and often run into exceptions without any useful information on how to debug.
Sometimes it is something on our end and sometimes bugs in Xamarin, especially Xamarin Forms.
The most usual exception is a NullReferenceException
that we have a hard time to troubleshoot.
If we could get access to Xamarin Forms symbols it would be a lot easier to pinpoint issues by stepping through both our code and Xamarin code.
Is there a way to get a Xamarin symbols package, ie a pdb-file with nuget?
(Compling directly from source creates issues when using 3rd party packages).
Open Settings: Tools->Options -> Debugging -> Symbols and add directory, where your . PDB files are located. You can add custom path, like for each project, and also you can edit common path, where Visual Studio will save all .
A program database file (extension . pdb) is a binary file that contains type and symbolic debugging information gathered over the course of compiling and linking the project. A PDB file is created when you compile a C/C++ program with /ZI or /Zi or a Visual Basic, Visual C#, or JScript program with the /debug option.
pdb file stores all debug information for the project's .exe file, and resides in the \debug subdirectory. The <project>. pdb file contains full debug information, including function prototypes, not just the type information found in VC<x>. pdb.
If you examine the Xamarin.Forms package, it contains mdb
and pdb
files so technically speaking you would be able to debug through Xamarin.Forms code.
If you want to go through Xamarin.Forms code, you can check this "hack" that includes pdb files automatically modifiying compilation's targets.
https://forums.xamarin.com/discussion/73572/debug-stepping-into-own-nuget-package
You can use the mono command line.
You can use the function mono_print_method_from_ip
(which takes an address) to obtain the name of a method given an address. This is particularly useful when examining stack traces. The function was renamed to mono_pmip
in the Mono 1.1.x serie s (For a while the function was called mono_print_method_from_ip
).
For example, when faced with a stack trace, like this:
(gdb) where
#0 ves_icall_System_String_GetHashCode (me=0x80795d0) at string-icalls.c:861
#1 0x0817f490 in ?? ()
#2 0x0817f42a in ?? ()
#3 0x0817f266 in ?? ()
#4 0x0817f1a5 in ?? ()
You can find out what methods are at each address using the mono_print_method_from_ip function (or mono_pmip if you are using Mono 1.1.x):
(gdb) p mono_pmip (0x0817f490)
IP 0x817f490 at offset 0x28 of method (wrapper managed-to-native) System.String:GetHashCode () (0x817f468 0x817f4a4)
$1 = void
(gdb) p mono_pmip (0x0817f42a)
IP 0x817f42a at offset 0x52 of method System.Collections.Hashtable:GetHash (object) (0x817f3d8 0x817f43b)
$2 = void
Reference http://www.mono-project.com/docs/debug+profile/debug/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With