Object Reference not set to an instance of an object?

Hello Everyone

I'm new to Xamarin and currently converting an Silverlight App to an UWP App using a SharedProject(No Xamarin.Forms!, Next step after this would then be, doing it for iOS and Android using Xamarin.Forms). But when i try to build the app in VisualStudio17 i get following error: "Object reference not set to an instance of an object", what this is means is clear to me... But it does not say where this error happened(which file, which line).

So my Question is... Why doesn't it show me where the error happened? And how do i find the file the error happened in?

Help would be greatly appreciated.

Thanks and greetings
Silas

Answers

  • BageraBagera Abd alhadi Al-Tinawi US ✭✭

    Hi @SilasNaef

    Well, this error is so annoying, I had one today and I will tell you how i fix it but, before that I recommend you to do debugging in the method that throws this error.

    For me, I as passing a null object to a constructor:

    `public MyClass(ClassB b)
    {
    Id = b.Id;

            Number = b.Number;            
        }`
    

    Because b is null, I was getting this error .

    Hope that will help you

  • SilasNaefSilasNaef Silas Naef US

    hello @Bagera

    Thanks for the advice, but this cant really be the issue in my case, since the code was already running in a different project, in my opinion it has to be the issue with some namespace which is available in Silverlight but is not anymore in UWP.

    But since u cant see my code i was hoping you could tell how to find the Error in my code without debugging.

    Thanks and have a nice day

Sign In or Register to comment.