Set CLSCompliant attribute where possible#705
Merged
Conversation
baywet
reviewed
Apr 23, 2026
baywet
approved these changes
Apr 24, 2026
Copilot AI
added a commit
that referenced
this pull request
May 5, 2026
- Add CLSCompliant assembly attribute to abstractions and http projects - Retain central package management (no explicit versions) - Retain updated TFM conditions without net5.0 - Pick up CLSCompliant changes from main (fix: Set CLSCompliant attribute where possible #705) Co-authored-by: MIchaelMainer <8527305+MIchaelMainer@users.noreply.github.com>
This was referenced May 6, 2026
Merged
This was referenced May 8, 2026
Open
github-actions Bot
pushed a commit
to EelcoLos/nx-tinkering
that referenced
this pull request
May 12, 2026
Updated [Microsoft.Kiota.Abstractions](https://github.com/microsoft/kiota-dotnet) from 1.22.0 to 1.22.2. <details> <summary>Release notes</summary> _Sourced from [Microsoft.Kiota.Abstractions's releases](https://github.com/microsoft/kiota-dotnet/releases)._ ## 1.22.2 ## [1.22.2](microsoft/kiota-dotnet@v1.22.1...v1.22.2) (2026-05-05) ### Bug Fixes * Set CLSCompliant attribute where possible ([#705](microsoft/kiota-dotnet#705)) ([f6c21e4](microsoft/kiota-dotnet@f6c21e4)) ## 1.22.1 ## [1.22.1](microsoft/kiota-dotnet@v1.22.0...v1.22.1) (2026-03-19) ### Bug Fixes * adds missing parentheses in pattern matching ([#671](microsoft/kiota-dotnet#671)) ([50d535e](microsoft/kiota-dotnet@50d535e)) * performance issue with enum parsing during deserialization ([#670](microsoft/kiota-dotnet#670)) ([3a09234](microsoft/kiota-dotnet@3a09234)) Commits viewable in [compare view](microsoft/kiota-dotnet@v1.22.0...v1.22.2). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Eelco Los <5102501+EelcoLos@users.noreply.github.com>
This was referenced May 13, 2026
This was referenced May 20, 2026
This was referenced Jun 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
We set "CLSCompliant" it to "true" in our projects because our application provides a VB.NET based scripting, and thus all libraries that could be accessed by the VB.NET code should be CLSCompliant (e.g. to avoid the situation "protected member variable and property for this variable with same name, only differing in casing").
After having added the first Kiota generated REST client, I had to disable the "not CLSCompliant" warnings for this client with a ".editorconfig" file.
This pull request tries to make Kiota CLSCompliant.
It is not possible for the project "Microsoft.Kiota.Authentication.Azure" because it has public api using classes from Azure.Core that is also not CLSCompliant. That's why I set the attribute per project.
Only problem:
IParseNodedefines a propery of type "sbyte" that is not CLSCompliant:kiota-dotnet/src/abstractions/serialization/IParseNode.cs
Lines 39 to 43 in 9e4d0e3
To my understanding, I can make the projects CLSCompliant anyway, and I just have to disable the warning for all code parts that are not CLS compliant.
This is done by setting
[CLSCompliant(false)]where possible. Only theIParseNodeinterface requires a#pragma warning disable CS3002because the attribute is not allowed on interface members.In project "Microsoft.Kiota.Serialization.Json", there was a warning
\obj\Debug\netstandard2.1\System.Text.Json.SourceGeneration\System.Text.Json.SourceGeneration.JsonSourceGenerator\MySerialKiotaJsonSerializationContext.SByte.g.cs(19,84,19,89): warning CS3003: Type of 'KiotaJsonSerializationContext.SByte' is not CLS-compliant. that was not suppressible with a ".editconfig" file - it does not accept paths in the "obj" directory.I first created a roslyn issue (https://www.github.com/dotnet/roslyn/issues/83232), and the bot pointed me to a workaround (https://www.github.com/dotnet/roslyn/issues/47384#issuecomment-3529305512): add a ".globalconfig" file in the project that disables the warning:
This affects also generated files.
Then add a ".editorconfig" file that enabled the warning again:
This file does NOT affect generated files, so the warning from them is still suppressed by ".globalconfig".
As there was also a suppression workaorund for "CS1591: Missing XML comment..." in "Microsoft.Kiota.Serialization.Json" that should probably also affect only generated files, I moved this suppression also to the new files.
Roslyn already contains a fix (https://www.github.com/dotnet/roslyn/pull/82224) so that you can specify suppressions for generated paths in ".editorconfig", but this fix does not seem to be released.
Hope my idea is acceptable ;-)