views:

216

answers:

2

i'm programmatically doing an openid handshake with yahoo and google. google is fine, but yahoo throws a null pointer:

stack trace:

   System.NullReferenceException: Object reference not set to an instance of an object.
   at DotNetOpenAuth.OpenId.Extensions.ProviderAuthenticationPolicy.PolicyResponse.DotNetOpenAuth.Messaging.IMessageWithEvents.OnReceiving() in c:\Users\andarno\git\dotnetopenid\src\DotNetOpenAuth\OpenId\Extensions\ProviderAuthenticationPolicy\PolicyResponse.cs:line 189
   at DotNetOpenAuth.OpenId.ChannelElements.ExtensionsBindingElement.<GetExtensions>d__a.MoveNext() in c:\Users\andarno\git\dotnetopenid\src\DotNetOpenAuth\OpenId\ChannelElements\ExtensionsBindingElement.cs:line 209
   at DotNetOpenAuth.OpenId.ChannelElements.ExtensionsBindingElement.ProcessIncomingMessage(IProtocolMessage message) in c:\Users\andarno\git\dotnetopenid\src\DotNetOpenAuth\OpenId\ChannelElements\ExtensionsBindingElement.cs:line 151
   at DotNetOpenAuth.Messaging.Channel.ProcessIncomingMessage(IProtocolMessage message) in c:\Users\andarno\git\dotnetopenid\src\DotNetOpenAuth\Messaging\Channel.cs:line 906
   at DotNetOpenAuth.OpenId.ChannelElements.OpenIdChannel.ProcessIncomingMessage(IProtocolMessage message) in c:\Users\andarno\git\dotnetopenid\src\DotNetOpenAuth\OpenId\ChannelElements\OpenIdChannel.cs:line 171
   at DotNetOpenAuth.Messaging.Channel.ReadFromRequest(HttpRequestInfo httpRequest) in c:\Users\andarno\git\dotnetopenid\src\DotNetOpenAuth\Messaging\Channel.cs:line 377
   at DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.GetResponse(HttpRequestInfo httpRequestInfo) in c:\Users\andarno\git\dotnetopenid\src\DotNetOpenAuth\OpenId\RelyingParty\OpenIdRelyingParty.cs:line 489
   at DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.GetResponse() in c:\Users\andarno\git\dotnetopenid\src\DotNetOpenAuth\OpenId\RelyingParty\OpenIdRelyingParty.cs:line 478
   at Friendsell.UI.Controllers.Auth.OpenIdReturnController.DoProcessRequest(IExecutionContext context) in C:\Development\Friendsell\Friendsell.UI\Controllers\Auth\OpenIdController.cs:line 41
   at Bistro.Controllers.AbstractController.ProcessRequest(HttpContextBase context, IContext requestContext) in C:\Development\Bistro\Bistro.Core\Controllers\AbstractController.cs:line 41
   at Bistro.Controllers.MethodDispatcher.InvokeMethodDirect(HttpContextBase context, String requestPoint, IContext requestContext) in C:\Development\Bistro\Bistro.Core\Controllers\MethodDispatcher.cs:line 221
   at Bistro.Controllers.MethodDispatcher.InvokeMethod(HttpContextBase context, String requestPoint, IContext requestContext) in C:\Development\Bistro\Bistro.Core\Controllers\MethodDispatcher.cs:line 119

invoking code:

        var openid = new OpenIdRelyingParty();
        IAuthenticationRequest request = openid.CreateRequest(
            Identifier.Parse(
                GetEndpoint()),
                new Realm(realm),
                new Uri(returnUri));

        // Require some additional data
        request.AddExtension(new ClaimsRequest
        {
            Email = DemandLevel.Require,
            FullName = DemandLevel.Request,
            PostalCode = DemandLevel.Request
        });

        try
        {
            request.RedirectToProvider();
        } catch (ThreadAbortException)
        {
        }

receiving code (and the source of the exception)

        var openId = new OpenIdRelyingParty();
        var response = openId.GetResponse(); <-- exception happens here

what gives? the weird thing is that the yahoo piece was working recently, and i haven't changed the library version...

A: 

I think you want to look at your CreateRequest. Also you can't catch ThreadAbortException, it self-propagates. Therefore you need to catch it twice.

Woot4Moo
what about it can cause that exception?
kolosy
After reading the link below, it appears as though it was unable to pass around the proper data. Which in turn to answer your comment, the CreateRequest method was receiving nulled out data. If you are asking about the ThreadAbortException, you are the one trying to catch it :)
Woot4Moo
+1  A: 

looks like it's an issue on yahoo's end:

http://groups.google.com/group/dotnetopenid/browse_thread/thread/9e92ff8a7f72c56b/96b0803f1f9337a6?show_docid=96b0803f1f9337a6

3.3.1 handles it.

kolosy
Yup. That's it.
Andrew Arnott