-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Null processing for ${aspnet-session:Variable=User.Name:EvaluateAsNestedProperties=true} #69
Comments
Thanks for your proposal. Did you try it with null value? If yes, what is the result? |
Yes, sure, I tried with null value. And exception is: |
So null checking would be useful. But we need to check the side affects. What do you tkink @304NotModified? |
I think this is the best approach:
|
I just opened a bug fix issue for this, #70 @worldofsites,
but it is actually
Is it just a typo in the issue or could it be the reason? Thanks for reporting! |
@UgurAldanmaz |
You are right. Sorry for my oversight. |
@UgurAldanmaz @304NotModified |
PS it's OK for me to move to VS2015 (C# 6) |
Session["user"] = new UserInfo { Name= "johnDoe", Id = 100};
layout="${aspnet-session:Variable=User.Name:EvaluateAsNestedProperties=true}"
I think there need to null check for Session["user"].
If object is not null, then try to read property of that object, else return.
From NLog.Web.Internal => PropertyReader => method GetPropertyInfo:
return value.GetType().GetProperty(propertyName); // "value" can be null here
.Thanks.
The text was updated successfully, but these errors were encountered: