Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8415823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:33:31+00:00 2026-06-10T01:33:31+00:00

So! My head just exploded because this seems very strange to me. Using debug

  • 0

So! My head just exploded because this seems very strange to me. Using debug mode, I can watch the Claimsresponse come through into the method, its populated, and so is the Email property. But when I try a simple string myStr = response.Email; It throws a NullException error…

I don’t understand it..

Code: (settings email fails!)

public static bool LoginUserUsingOpenID(BaseDBContext db, ClaimsResponse r)
            {
                string email = r.Email;
                bool doesntExist = !UserHelper.DoesUserExist(db, r.Email);

                User u = null;

                if (doesntExist)
                {
                    u.Email = email;
                    u.Username = "User" + new Random().Next(100000);
                    u.Password = CreateRandomPassword(7);
                    u.prepareForCreationFromThirdParty();
                }
                else
                {
                    u = db.Users.Where(x => x.Email == r.Email).FirstOrDefault();
                }
                SetUserAsAuthenticated(u);
                AddAutomaticLoginKeyForUser(db, u); //Need to get this to the users frontend somehow..
                return true;
            }

Here is the stack trace:

System.NullReferenceException: Object reference not set to an instance of an object.
   at MusingMonkey.Helpers.SecurityHelper.LoginUserUsingOpenID(BaseDBContext db, ClaimsResponse r) in C:\Users\William-Business\Desktop\TWB\TWB Central\Projects\MusingMonkey\MusingMonkey\Helpers\SecurityHelper.cs:line 170
   at MusingMonkey.Controllers.UsersController.HandleOpenIDResponse() in C:\Users\William-Business\Desktop\TWB\TWB Central\Projects\MusingMonkey\MusingMonkey\Controllers\UsersController.cs:line 78
   at lambda_method(Closure , ControllerBase , Object[] )
   at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
   at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41()
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<>c__DisplayClass2a.<BeginInvokeAction>b__20()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T01:33:33+00:00Added an answer on June 10, 2026 at 1:33 am

    Erm, are you sure that is is the r.Email line that is throwing the NRE?

    Because the smoke seems to emanate from the following line:

    User u = null;
    

    and then you are attempting to access the u instance without ever instantiating this variable:

    if (doesntExist)
    {
        u.Email = email;
        ...
    

    So you probably meant something else, like for example:

    User u = new User();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't wrap my head around oop just yet, so I'm sticking with procedural
Just trying to get my head around what can happen when things go wrong
Maybe I am over complicating this in my head but I just don't know
I just can't get my head around why I can't get the below shown
Just to head off the quick-repliers, I'll mention that I'm not using MySQL so
I just can't get around my head about AUTO_CREATE_STATISTICS? I run the tuning advisor
Just getting my head around WCF, so forgive me for the inelegant coding. The
I am just trying to get my head around various pointer concepts and I
Just trying to still get my head around IOC principles. Q1: Static Methods -
I am just trying to get my head around simple view switching for the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.