IdentityServer4 icon indicating copy to clipboard operation
IdentityServer4 copied to clipboard

IdentityServer4.Endpoints.Results.TokenResult throws exception (for some users only)

Open duhtmep opened this issue 7 years ago • 4 comments

Hello

May I ask for a short look and a hint what is going wrong here? Many thanks in advance!

Get this exception for some users in our database: 2019-03-11 12:30:32.5384 [75] FATAL IdentityServer4.Hosting.IdentityServerMiddleware - Unhandled exception: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. System.### NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. bei IdentityServer4.Extensions.DictionaryExtensions.AddDictionary(JObject jobject, Dictionary`2 dictionary) bei IdentityServer4.Endpoints.Results.TokenResult.d__5.MoveNext() --- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde --- bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) bei IdentityServer4.Hosting.IdentityServerMiddleware.d__3.MoveNext()|

image

Exception origin is somewhere here i think.

Related to Response.Custom field?? When do we expect this field to be set??

Many thanks for any hint!

duhtmep avatar Mar 11 '19 17:03 duhtmep

Response.Custom is not set by us anywhere. You must use some extensibility point somewhere and set it?!

leastprivilege avatar Mar 12 '19 05:03 leastprivilege

Found the issue:

In our LoginValidator we add some custom data to the dictionary, like: customResponse.Add("CultureInfoCode", user.CultureInfoCode);

When user.CultureInfoCode is NULL in this case the exception is thrown during the AddDictionary call

Maybe there should be a possibility to have null values here??

Only a hint. Not important for me now!

Many thanks!

duhtmep avatar Mar 12 '19 08:03 duhtmep

How about you check for null? ;)

leastprivilege avatar Mar 12 '19 15:03 leastprivilege

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 11 '20 18:01 lock[bot]