Visual Studio Xamarin.Forms Debugging: How to step into an external library method?

177 Views Asked by At

Sometimes an exception is thrown from inside the Xamarin.Forms external library and it would be extremely helpful to view the pertinent local variables in the debugger as we would in our own code.

Here is the stacktrace of my current Android iOS project headache:

System.InvalidCastException: Specified cast is not valid.

    at Xamarin.Forms.BindableLayoutController.CreateItemView (System.Object item, Xamarin.Forms.DataTemplate dataTemplate) [0x00003] in D:\a\1\s\Xamarin.Forms.Core\BindableLayout.cs:261   

    at Xamarin.Forms.BindableLayoutController.CreateItemView (System.Object item, Xamarin.Forms.Layout`1[T] layout) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableLayout.cs:254

    at Xamarin.Forms.BindableLayoutController.CreateChildren () [0x00040] in D:\a\1\s\Xamarin.Forms.Core\BindableLayout.cs:234

    at Xamarin.Forms.BindableLayoutController.SetItemTemplate (Xamarin.Forms.DataTemplate itemTemplate) [0x0005a] in D:\a\1\s\Xamarin.Forms.Core\BindableLayout.cs:180

    at Xamarin.Forms.BindableLayoutController.set_ItemTemplate (Xamarin.Forms.DataTemplate value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableLayout.cs:127

    at Xamarin.Forms.BindableLayout+<>c.<.cctor>b__19_1 (Xamarin.Forms.BindableObject b, System.Object o, System.Object n) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableLayout.cs:16

    at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:463

    at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:397

    at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x00042] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:334

    at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:311

    at Xamarin.Forms.BindableLayout.SetItemTemplate (Xamarin.Forms.BindableObject b, Xamarin.Forms.DataTemplate value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableLayout.cs:45

    at SecretProjectName.Views.YourAmazingClassPage..ctor () [0x0005b] in C:\Users\UserName\source\repos\SecretProjectName\SecretProjectName\SecretProjectName\Views\YourAmazingClassPage.xaml.cs:20

    at (wrapper managed-to-native) System.Reflection.RuntimeConstructorInfo.InternalInvoke(System.Reflection.RuntimeConstructorInfo,object,object[],System.Exception&)

    at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:936

Is there any other way to do this than forking Xamarin.Forms source code into my project?

1

There are 1 best solutions below

0
Ivan Ičin On

DLLs are always compiled, thus you can't step in. They don't contain your (or someone elses) code in its source, it is modified by the process of compilation.