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
NotSupportedException thrown by SA1602EnumerationItemsMustBeDocumented #1359
Comments
Interesting. It works here in the tests. Wonder what's different. |
I just found that out too! Could something else be loading a different version of the Newtonsoft serializer into the AppDomain? |
visual studio could have loaded json.net |
Even if I downgrade json.net all the way back to a version from 2013 I still can't get the test to fail. Maybe it could be related to the version of System.Collections.Immutable used at runtime. Anyway, the workaround is easy: don't use variables. |
I found the underlying problem (see link ⬆️). Grabbing this to implement a workaround. |
This works around JamesNK/Newtonsoft.Json#652 by avoiding the direct use of immutable types in the serialization process. The result remains efficient because the builder class caches the last returned immutable instance, and will continue returning the same instance as long as no changes are made to the builder. Fixes DotNetAnalyzers#1359
I suspect that this is because of trying to use an
ImmutableDictionary<>
in a type that's used with the JSON serializer. I'm sure it will try to callIDictionary<T>.Add()
when populating a dictionary property if it isn't null initially.My brand new settings file uses the variables property.
The text was updated successfully, but these errors were encountered: