Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/abstractions/Microsoft.Kiota.Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
<GenerateCompatibilitySuppressionFile>false</GenerateCompatibilitySuppressionFile>
</PropertyGroup>

<ItemGroup>
<AssemblyAttribute Include="System.CLSCompliantAttribute">
<_Parameter1>true</_Parameter1>
</AssemblyAttribute>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.14.15">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
2 changes: 2 additions & 0 deletions src/abstractions/serialization/IParseNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ public interface IParseNode
/// Gets the sbyte value of the node.
/// </summary>
/// <returns>The sbyte value of the node.</returns>
#pragma warning disable CS3002 // Return type is not CLS-compliant
Comment thread
baywet marked this conversation as resolved.
sbyte? GetSbyteValue();
#pragma warning restore CS3002 // Return type is not CLS-compliant
/// <summary>
/// Gets the integer value of the node.
/// </summary>
Expand Down
2 changes: 2 additions & 0 deletions src/abstractions/serialization/ISerializationWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ public interface ISerializationWriter : IDisposable
/// </summary>
/// <param name="key">The key to be used for the written value. May be null.</param>
/// <param name="value">The sbyte value to be written.</param>
#pragma warning disable CS3001 // Argument type is not CLS-compliant
void WriteSbyteValue(string? key, sbyte? value);
#pragma warning restore CS3001 // Argument type is not CLS-compliant
/// <summary>
/// Writes the specified byte integer value to the stream with an optional given key.
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions src/bundle/Microsoft.Kiota.Bundle.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
<GenerateCompatibilitySuppressionFile>false</GenerateCompatibilitySuppressionFile>
</PropertyGroup>

<ItemGroup>
<AssemblyAttribute Include="System.CLSCompliantAttribute">
<_Parameter1>true</_Parameter1>
</AssemblyAttribute>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\abstractions\Microsoft.Kiota.Abstractions.csproj" />
<ProjectReference Include="..\http\httpClient\Microsoft.Kiota.Http.HttpClientLibrary.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
<GenerateCompatibilitySuppressionFile>false</GenerateCompatibilitySuppressionFile>
</PropertyGroup>

<ItemGroup>
<AssemblyAttribute Include="System.CLSCompliantAttribute">
<_Parameter1>true</_Parameter1>
</AssemblyAttribute>
</ItemGroup>

<!-- NET 5 target to be removed on next major version-->
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0' or '$(TargetFramework)'== 'netStandard2.0' or '$(TargetFramework)' == 'netStandard2.1' or '$(TargetFramework)' == 'net462'">
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="[6.0,)" />
Expand Down
1 change: 1 addition & 0 deletions src/serialization/form/FormParseNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ private void AssignFieldValues<T>(T item) where T : IParsable
}

/// <inheritdoc/>
[CLSCompliant(false)]
public sbyte? GetSbyteValue() => sbyte.TryParse(DecodedValue, NumberStyles.Number, CultureInfo.InvariantCulture, out var result) ? result : null;

/// <inheritdoc/>
Expand Down
1 change: 1 addition & 0 deletions src/serialization/form/FormSerializationWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ public void WriteObjectValue<T>(string? key, T? value, params IParsable?[] addit
OnAfterObjectSerialization?.Invoke(value);
}
/// <inheritdoc/>
[CLSCompliant(false)]
public void WriteSbyteValue(string? key, sbyte? value)
{
if(value.HasValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
<GenerateCompatibilitySuppressionFile>false</GenerateCompatibilitySuppressionFile>
</PropertyGroup>

<ItemGroup>
<AssemblyAttribute Include="System.CLSCompliantAttribute">
<_Parameter1>true</_Parameter1>
</AssemblyAttribute>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\abstractions\Microsoft.Kiota.Abstractions.csproj" />
</ItemGroup>
Expand Down
15 changes: 15 additions & 0 deletions src/serialization/json/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#Part 2 of a workaround for two types of warning in files generated by the JsonSerializer:
#"kiota-dotnet\src\serialization\json\obj\Debug\netstandard2.1\System.Text.Json.SourceGeneration\System.Text.Json.SourceGeneration.JsonSourceGenerator\KiotaJsonSerializationContext.SByte.g.cs(12,99,12,104): error CS3003: Type of 'KiotaJsonSerializationContext.SByte' is not CLS-compliant"
#Those warnings cannot be disabled by a path filter in a ".editorconfig" file.
#See https://github.com/dotnet/roslyn/issues/83232: disable the warnings in ".globalconfig".
#Then re-enable them with a ".editorconfig" file (which affects only non-generated files)
#
#Suppressing the warning in ".editorconfig" only (without ".globalconfig") might work in the future if the fix https://github.com/dotnet/roslyn/pull/82224 is released.
#It will require a special path expression like "[$generated$/**/*.cs]"

[*.{cs}]
Comment thread
baywet marked this conversation as resolved.
#CS3003: Type of '...' is not CLS-compliant
dotnet_diagnostic.CS3003.severity = warning

#CS1591: Missing XML comment for publicly visible type or member '...'
dotnet_diagnostic.CS1591.severity = warning
10 changes: 10 additions & 0 deletions src/serialization/json/.globalconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#Part 1 of a workaround for two types of warning in files generated by the JsonSerializer:
#"kiota-dotnet\src\serialization\json\obj\Debug\netstandard2.1\System.Text.Json.SourceGeneration\System.Text.Json.SourceGeneration.JsonSourceGenerator\KiotaJsonSerializationContext.SByte.g.cs(12,99,12,104): error CS3003: Type of 'KiotaJsonSerializationContext.SByte' is not CLS-compliant"
#Those warnings cannot be disabled by a path filter in a ".editorconfig" file.
#See https://github.com/dotnet/roslyn/issues/83232: disable the warnings in ".globalconfig".
#Then re-enable them with a ".editorconfig" file (which affects only non-generated files).

#CS1591: Missing XML comment for publicly visible type or member 'KiotaJsonSerializationContext.Boolean'
dotnet_diagnostic.CS1591.severity = silent
Comment thread
baywet marked this conversation as resolved.
#CS3003: Type of 'ClassWithNonClsCompliantProperty.SByteProp' is not CLS-compliant
dotnet_diagnostic.CS3003.severity = silent
1 change: 1 addition & 0 deletions src/serialization/json/JsonParseNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public JsonParseNode(JsonElement node, KiotaJsonSerializationContext jsonSeriali
/// Get the sbyte value from the json node
/// </summary>
/// <returns>A sbyte value</returns>
[CLSCompliant(false)]
public sbyte? GetSbyteValue() => GetSbyteValue(_jsonNode);

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/serialization/json/JsonSerializationWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public void WriteByteValue(string? key, byte? value)
/// </summary>
/// <param name="key">The key of the json node</param>
/// <param name="value">The sbyte value</param>
[CLSCompliant(false)]
public void WriteSbyteValue(string? key, sbyte? value)
{
if(!string.IsNullOrEmpty(key) && value.HasValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
<!-- NET 5 target to be removed on next major version-->
<TargetFrameworks>netstandard2.0;netstandard2.1;net5.0;net6.0;net8.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS1591</NoWarn> <!-- Ignore warning from code generated by source generators
from System.Text.Json-->
<EnablePackageValidation>true</EnablePackageValidation>
<GenerateCompatibilitySuppressionFile>false</GenerateCompatibilitySuppressionFile>
</PropertyGroup>
Expand All @@ -16,6 +14,12 @@
<PackageReference Include="System.Text.Json" Version="[6.0.10,)" />
</ItemGroup>

<ItemGroup>
<AssemblyAttribute Include="System.CLSCompliantAttribute">
<_Parameter1>true</_Parameter1>
</AssemblyAttribute>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\abstractions\Microsoft.Kiota.Abstractions.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
<GenerateCompatibilitySuppressionFile>false</GenerateCompatibilitySuppressionFile>
</PropertyGroup>

<ItemGroup>
<AssemblyAttribute Include="System.CLSCompliantAttribute">
<_Parameter1>true</_Parameter1>
</AssemblyAttribute>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\abstractions\Microsoft.Kiota.Abstractions.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public void WriteObjectValue<T>(string? key, T? value, params IParsable?[] addit
throw new InvalidOperationException($"Expected a MultiPartBody instance, but got {value?.GetType().Name ?? "null"}");
}
/// <inheritdoc/>
[CLSCompliant(false)]
public void WriteSbyteValue(string? key, sbyte? value) => throw new NotImplementedException();
/// <inheritdoc/>
public void WriteStringValue(string? key, string? value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
<GenerateCompatibilitySuppressionFile>false</GenerateCompatibilitySuppressionFile>
</PropertyGroup>

<ItemGroup>
<AssemblyAttribute Include="System.CLSCompliantAttribute">
<_Parameter1>true</_Parameter1>
</AssemblyAttribute>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\abstractions\Microsoft.Kiota.Abstractions.csproj" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/serialization/text/TextParseNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public TextParseNode(string? text)
/// <inheritdoc />
public T GetObjectValue<T>(ParsableFactory<T> factory) where T : IParsable => throw new InvalidOperationException(NoStructuredDataMessage);
/// <inheritdoc />
[CLSCompliant(false)]
public sbyte? GetSbyteValue() => sbyte.TryParse(Text, NumberStyles.Number, CultureInfo.InvariantCulture, out var result) ? result : null;
/// <inheritdoc />
public string? GetStringValue() => Text;
Expand Down
1 change: 1 addition & 0 deletions src/serialization/text/TextSerializationWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public Stream GetSerializedContent()
/// <inheritdoc />
public void WriteObjectValue<T>(string? key, T? value, params IParsable?[] additionalValuesToMerge) where T : IParsable => throw new InvalidOperationException(TextParseNode.NoStructuredDataMessage);
/// <inheritdoc />
[CLSCompliant(false)]
public void WriteSbyteValue(string? key, sbyte? value) => WriteStringValue(key, value?.ToString(CultureInfo.InvariantCulture));
/// <inheritdoc />
public void WriteStringValue(string? key, string? value)
Expand Down
Loading