Skip to content

Commit

Permalink
feat(csharp): Update main dependencies + misc changes (#5279)
Browse files Browse the repository at this point in the history
feat(csharp): Update dependencies and patch vulnerable transitive dependencies by promoting them
  • Loading branch information
Swimburger authored Nov 26, 2024
1 parent 2d64e0a commit 56f4491
Show file tree
Hide file tree
Showing 1,307 changed files with 6,829 additions and 47,469 deletions.
11 changes: 11 additions & 0 deletions fern/pages/changelogs/csharp-sdk/2024-11-25.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## 1.9.11
**`(feat):`** Add two dependencies who previously were transitive dependencies to ensure the generated SDKs use the patched versions without vulnerabilities.
- `System.Net.Http` >= `4.3.4`
- `System.Text.RegularExpressions` >= `4.3.1`
Update other dependencies to the latest version:
- `Portable.System.DateTimeOnly` = `8.0.2` (on net462 & netstandard2.0)
- `PolySharp` = `1.15.0`
- `OneOf` = `3.0.271`
- `OneOf.Extended` = `3.0.271`


Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void ShouldSerializeKnownEnumValue2()
{
var json = JsonSerializer.SerializeToElement(new DummyObject { EnumProperty = KnownEnumValue2 },
JsonOptions);
TestContext.WriteLine("Serialized JSON: \n" + json);
TestContext.Out.WriteLine("Serialized JSON: \n" + json);
var enumString = json.GetProperty("enum_property").GetString();
Assert.That(enumString, Is.Not.Null);
Assert.That(enumString, Is.EqualTo(KnownEnumValue2String));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void ShouldSerializeKnownEnumValue2()
{
var json = JsonSerializer.SerializeToElement(new DummyObject { EnumProperty = KnownEnumValue2 },
JsonOptions);
TestContext.WriteLine("Serialized JSON: \n" + json);
TestContext.Out.WriteLine("Serialized JSON: \n" + json);
var enumString = json.GetProperty("enum_property").GetString();
Assert.That(enumString, Is.Not.Null);
Assert.That(enumString, Is.EqualTo(KnownEnumValue2));
Expand All @@ -64,7 +64,7 @@ public void ShouldSerializeUnknownEnum()
{
var json = JsonSerializer.SerializeToElement(new DummyObject { EnumProperty = UnknownEnumValue },
JsonOptions);
TestContext.WriteLine("Serialized JSON: \n" + json);
TestContext.Out.WriteLine("Serialized JSON: \n" + json);
var enumString = json.GetProperty("enum_property").GetString();
Assert.That(enumString, Is.Not.Null);
Assert.That(enumString, Is.EqualTo(UnknownEnumValue));
Expand Down
18 changes: 12 additions & 6 deletions generators/csharp/codegen/src/asIs/test/Template.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0"/>
<PackageReference Include="NUnit" Version="3.13.3"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2"/>
<PackageReference Include="NUnit.Analyzers" Version="3.6.1"/>
<PackageReference Include="coverlet.collector" Version="3.2.0"/>
<PackageReference Include="WireMock.Net" Version="1.5.60" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0"/>
<PackageReference Include="NUnit" Version="4.2.2"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0"/>
<PackageReference Include="NUnit.Analyzers" Version="4.4.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="WireMock.Net" Version="1.6.8" />
<PackageReference Include="FluentAssertions.Json" Version="6.1.0" />
</ItemGroup>

Expand Down
31 changes: 12 additions & 19 deletions generators/csharp/codegen/src/project/CsharpProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,23 +504,8 @@ class CsProj {
${projectGroup.join("\n")}
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0' Or '$(TargetFramework)' == 'net462' Or '$(TargetFramework)' == 'netstandard2.0'">
<PolySharpIncludeRuntimeSupportedAttributes>true</PolySharpIncludeRuntimeSupportedAttributes>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net462' Or '$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Portable.System.DateTimeOnly" Version="8.0.1" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0' Or '$(TargetFramework)' == 'net6.0' Or '$(TargetFramework)' == 'net462' Or '$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="PolySharp" Version="1.14.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Portable.System.DateTimeOnly" Version="8.0.2" />
</ItemGroup>
<ItemGroup>
Expand All @@ -544,9 +529,17 @@ ${this.getAdditionalItemGroups().join(`\n${FOUR_SPACES}`)}

private getDependencies(): string[] {
const result: string[] = [];
result.push('<PackageReference Include="OneOf" Version="3.0.263" />');
result.push('<PackageReference Include="OneOf.Extended" Version="3.0.263" />');
result.push('<PackageReference Include="PolySharp" Version="1.15.0">');
result.push(
`${FOUR_SPACES}<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>`
);
result.push(`${FOUR_SPACES}<PrivateAssets>all</PrivateAssets>`);
result.push("</PackageReference>");
result.push('<PackageReference Include="OneOf" Version="3.0.271" />');
result.push('<PackageReference Include="OneOf.Extended" Version="3.0.271" />');
result.push('<PackageReference Include="System.Text.Json" Version="8.0.5" />');
result.push('<PackageReference Include="System.Net.Http" Version="[4.3.4,)" />');
result.push('<PackageReference Include="System.Text.RegularExpressions" Version="[4.3.1,)" />');
for (const [name, version] of Object.entries(this.context.getExtraDependencies())) {
result.push(`<PackageReference Include="${name}" Version="${version}" />`);
}
Expand Down Expand Up @@ -599,7 +592,6 @@ ${this.getAdditionalItemGroups().join(`\n${FOUR_SPACES}`)}
`${FOUR_SPACES}${FOUR_SPACES}<TargetFrameworks>net462;net8.0;net7.0;net6.0;netstandard2.0</TargetFrameworks>`
);
result.push(`${FOUR_SPACES}${FOUR_SPACES}<ImplicitUsings>enable</ImplicitUsings>`);
result.push(`${FOUR_SPACES}${FOUR_SPACES}<NuGetAudit>false</NuGetAudit>`);
result.push(`${FOUR_SPACES}${FOUR_SPACES}<LangVersion>12</LangVersion>`);
result.push(`${FOUR_SPACES}${FOUR_SPACES}<Nullable>enable</Nullable>`);

Expand Down Expand Up @@ -638,6 +630,7 @@ ${this.getAdditionalItemGroups().join(`\n${FOUR_SPACES}`)}
if (this.githubUrl != null) {
result.push(`<PackageProjectUrl>${this.githubUrl}</PackageProjectUrl>`);
}
result.push("<PolySharpIncludeRuntimeSupportedAttributes>true</PolySharpIncludeRuntimeSupportedAttributes>");
return result;
}

Expand Down
32 changes: 0 additions & 32 deletions generators/csharp/playground/.gitignore

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions generators/csharp/playground/Playground.Test/UnitTest1.cs

This file was deleted.

10 changes: 0 additions & 10 deletions generators/csharp/playground/Playground/Playground.csproj

This file was deleted.

2 changes: 0 additions & 2 deletions generators/csharp/playground/Playground/Program.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export class BaseMockServerTestGenerator extends FileGenerator<CSharpFile, SdkCu
access: csharp.Access.Public,
body: csharp.codeblock((writer) => {
writer.writeLine("Server.Stop();");
writer.writeLine("Server.Dispose();");
}),
isAsync: false,
parameters: [],
Expand Down
14 changes: 14 additions & 0 deletions generators/csharp/sdk/versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@
# The C# SDK now uses forward-compatible enums which are not compatible with the previously generated enums.
# Set `enable-forward-compatible-enums` to `false` in the configuration to generate the old enums.
# irVersion: 53
- version: 1.9.11
createdAt: "2024-11-25"
changelogEntry:
- type: feat
summary: |
Add two dependencies who previously were transitive dependencies to ensure the generated SDKs use the patched versions without vulnerabilities.
- `System.Net.Http` >= `4.3.4`
- `System.Text.RegularExpressions` >= `4.3.1`
Update other dependencies to the latest version:
- `Portable.System.DateTimeOnly` = `8.0.2` (on net462 & netstandard2.0)
- `PolySharp` = `1.15.0`
- `OneOf` = `3.0.271`
- `OneOf.Extended` = `3.0.271`
irVersion: 53
- version: 1.9.10
createdAt: "2024-11-20"
changelogEntry:
Expand Down
2 changes: 2 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion seed/csharp-model/.gitignore

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions seed/csharp-model/alias-extends/src/SeedAliasExtends.sln

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 12 additions & 6 deletions seed/csharp-model/alias/src/SeedAlias.Test/SeedAlias.Test.csproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 56f4491

Please sign in to comment.