i made a couple of changes suggested in the comments above, and also defined the contact explicitly and it now loads the contact from the database fine. i'm really confused as to why as it's basically just refactoring, but the following is working: contact = context.contacts.firstordefault(x => x.uniqueid == identifier);

//if identifier isn't recognised return.
if (contact == default( 
     return "identifier not recognised. check correct type and identifier"; 

the fact that this working code is no different functionally to the code posted in my question confuses me. i guess it must have been something my vs was doing instead.

alex pavlov in the comments points to

this code is perfectly fine, i might have fixed it by restarting vs if it was simply that behaving strangely.

Related Query

More Query from same tag