Avoid exception: An item with the same key has already been added. Key: MicrosoftIdentityError #1382
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This exception occurs sometimes when there are errors during login. It's not always the case but perhaps something to do with Temp Data not being cleared during debugging/testing and restarting. In any case, it's easily solved by just setting the temp data value instead of adding it.
Update: I've replaced the
ILoginErrorAccessor
with my own just see how this is caused and it's not due to Temp Data not being cleared. It ends up being called twice if you accidentally redirect to the same oicd handler address that is handling it - then the same key is added twice. Obviously not common and shouldn't actually occur (oops!) but still can be avoided by not using "Set"Stack trace