Last post Jan 26, 2018 06:36 PM by mru22
Jan 23, 2018 09:39 PM|mru22|LINK
I have a project that uses the ClaimsPrincipal to get the CurrentUser.Identity.Name. When I run the same piece of code in Visual Studio 2017 the name field is blank.
This is not a .NET Core project but just a regular .NET library. The problem appears only happens in unit test applications and there is no problem when the code executes under IIS for example.
Did something change in the .NET System library that visual studio 2017 uses? I can replicate 100% of the time. If I create a 2015 project the code works perfectly as expected. In 2017 the code returns empty string. Again, this is only for Test projects
but still needed.
The object Im referring to is: ClaimsPrincipal.Current. And the property is
I found an article indicating that the ClaimsPrincipal changed for .NET core but I did not think it would would matter for regular .NET libraries.
Any suggestions to preserve the same outcome in 2017 as 2015 ?
Jan 25, 2018 09:40 AM|Deepak Panchal|LINK
Can you try to share the sample code or sample project?
We will try to make a test on our side and try to reproduce the issue on our side.
If it is some kind of bug then we can try to report it.
Thanks for your understanding.
Jan 26, 2018 06:36 PM|mru22|LINK
For us its simply open a unit test project in Visual studio 2017 and type the following:
In 2017 the value is an empty string.
In 2015 the value includes my NTID.