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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
dotnet-version: 10.0.x
- name: Compute build number
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion Directory.Version.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<!-- This must match the major and minor components of the referenced Microsoft.Extensions.Configuration package. -->
<VersionPrefix>9.0.0</VersionPrefix>
<VersionPrefix>10.0.0</VersionPrefix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ Destructuring means extracting pieces of information from an object and create p
],
```

This is how the first destructuring policy would look like:
This is how the first destructuring policy would look:

```csharp
namespace MyFirstNamespace;
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "9.0.100",
"version": "10.0.100",
"allowPrerelease": false,
"rollForward": "latestFeature"
}
Expand Down
12 changes: 6 additions & 6 deletions sample/Sample/Sample.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net462;net8.0;net9.0;net10.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>
Expand All @@ -15,14 +15,14 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="2.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.1.1" />
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="3.0.1" />
<PackageReference Include="Serilog.Expressions" Version="4.0.0" />
<PackageReference Include="Serilog.Expressions" Version="5.0.0" />
<PackageReference Include="Serilog.Formatting.Compact" Version="3.0.0" />
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" />
<PackageReference Include="Serilog.Enrichers.Thread" Version="4.0.0" />
<PackageReference Include="PolySharp" Version="1.15.0" PrivateAssets="all" />
</ItemGroup>

Expand Down
1 change: 1 addition & 0 deletions serilog-settings-configuration.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ II.2.12 &lt;HandlesEvent /&gt;&#xD;
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002EMemberReordering_002EMigrations_002ECSharpFileLayoutPatternRemoveIsAttributeUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
Expand Down
5 changes: 5 additions & 0 deletions serilog-settings-configuration.sln.DotSettings.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=1b016ada_002Dd437_002D4769_002Da97e_002D159b81809a02/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Solution" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
&lt;Solution /&gt;
&lt;/SessionState&gt;</s:String>
</wpf:ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Authors>Serilog Contributors</Authors>
<!-- These must match the Dependencies tab in https://www.nuget.org/packages/microsoft.extensions.configuration at
the target version. -->
<TargetFrameworks>net462;netstandard2.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.0;net8.0;net9.0;net10.0</TargetFrameworks>
<PackageTags>serilog;json;appsettings</PackageTags>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand All @@ -16,16 +16,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="PolySharp" Version="1.13.2" PrivateAssets="All" />
<PackageReference Include="Serilog" Version="4.2.0-*" />
<PackageReference Include="PolySharp" Version="1.15.0" PrivateAssets="All" />
<PackageReference Include="Serilog" Version="4.3.0" />
<None Include="..\..\assets\icon.png" Pack="true" PackagePath="" Visible="false" />
<None Include="..\..\README.md" Pack="true" PackagePath="" Visible="false" />
<InternalsVisibleTo Include="Serilog.Settings.Configuration.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100fb8d13fd344a1c6fe0fe83ef33c1080bf30690765bc6eb0df26ebfdf8f21670c64265b30db09f73a0dea5b3db4c9d18dbf6d5a25af5ce9016f281014d79dc3b4201ac646c451830fc7e61a2dfd633d34c39f87b81894191652df5ac63cc40c77f3542f702bda692e6e8a9158353df189007a49da0f3cfd55eb250066b19485ec" />
</ItemGroup>

<ItemGroup>
<!-- The versions of all references in this group must match the major and minor components of the package version prefix. -->
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="10.0.0" />
</ItemGroup>
</Project>
43 changes: 17 additions & 26 deletions test/Serilog.Settings.Configuration.Tests/PublishSingleFileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,99 +2,90 @@
using System.Text;
using CliWrap;
using CliWrap.Exceptions;
using FluentAssertions;
using FluentAssertions.Execution;
using Serilog.Settings.Configuration.Tests.Support;
using Xunit.Abstractions;

namespace Serilog.Settings.Configuration.Tests;

[Trait("Category", "Integration")]
public sealed class PublishSingleFileTests : IDisposable, IClassFixture<TestApp>
public sealed class PublishSingleFileTests : IClassFixture<TestApp>
{
readonly ITestOutputHelper _outputHelper;
readonly TestApp _testApp;
readonly AssertionScope _scope;

public PublishSingleFileTests(ITestOutputHelper outputHelper, TestApp testApp)
{
_outputHelper = outputHelper;
_testApp = testApp;
_scope = new AssertionScope();
}

public void Dispose()
{
_scope.Dispose();
}

[Theory]
[ClassData(typeof(PublishModeTheoryData))]
public async Task RunTestApp_NoUsingAndNoAssembly(PublishMode publishMode)
{
var (isSingleFile, stdOut, stdErr) = await RunTestAppAsync(publishMode);
stdOut.Should().Be(isSingleFile ? "Expected exception" : "(Main thread) [Information] Expected success");
stdErr.Should().BeEmpty();
Assert.Equal(stdOut, isSingleFile ? "Expected exception" : "(Main thread) [Information] Expected success");
Assert.Empty(stdErr);
}

[Theory]
[ClassData(typeof(PublishModeTheoryData))]
public async Task RunTestApp_UsingConsole(PublishMode publishMode)
{
var (isSingleFile, stdOut, stdErr) = await RunTestAppAsync(publishMode, "--using-console");
stdOut.Should().Be(isSingleFile ? "() [Information] Expected success" : "(Main thread) [Information] Expected success");
Assert.Equal(stdOut, isSingleFile ? "() [Information] Expected success" : "(Main thread) [Information] Expected success");
if (isSingleFile)
stdErr.Should().Contain("Unable to find a method called WithThreadName");
Assert.Contains("Unable to find a method called WithThreadName", stdErr);
else
stdErr.Should().BeEmpty();
Assert.Empty(stdErr);
}

[Theory]
[ClassData(typeof(PublishModeTheoryData))]
public async Task RunTestApp_UsingThread(PublishMode publishMode)
{
var (isSingleFile, stdOut, stdErr) = await RunTestAppAsync(publishMode, "--using-thread");
stdOut.Should().Be(isSingleFile ? "" : "(Main thread) [Information] Expected success");
Assert.Equal(stdOut, isSingleFile ? "" : "(Main thread) [Information] Expected success");
if (isSingleFile)
stdErr.Should().Contain("Unable to find a method called Console");
Assert.Contains("Unable to find a method called Console", stdErr);
else
stdErr.Should().BeEmpty();
Assert.Empty(stdErr);
}

[Theory]
[ClassData(typeof(PublishModeTheoryData))]
public async Task RunTestApp_AssemblyThread(PublishMode publishMode)
{
var (_, stdOut, stdErr) = await RunTestAppAsync(publishMode, "--assembly-thread");
stdOut.Should().BeEmpty();
stdErr.Should().Contain("Unable to find a method called Console");
Assert.Empty(stdOut);
Assert.Contains("Unable to find a method called Console", stdErr);
}

[Theory]
[ClassData(typeof(PublishModeTheoryData))]
public async Task RunTestApp_AssemblyConsole(PublishMode publishMode)
{
var (_, stdOut, stdErr) = await RunTestAppAsync(publishMode, "--assembly-console");
stdOut.Should().Be("() [Information] Expected success");
stdErr.Should().Contain("Unable to find a method called WithThreadName");
Assert.Equal("() [Information] Expected success", stdOut);
Assert.Contains("Unable to find a method called WithThreadName", stdErr);
}

[Theory]
[ClassData(typeof(PublishModeAndStrategyTheoryData))]
public async Task RunTestApp_ConsoleAndThread(PublishMode publishMode, string strategy)
{
var (_, stdOut, stdErr) = await RunTestAppAsync(publishMode, $"--{strategy}-console", $"--{strategy}-thread");
stdOut.Should().Be("(Main thread) [Information] Expected success");
stdErr.Should().BeEmpty();
Assert.Equal("(Main thread) [Information] Expected success", stdOut);
Assert.Empty(stdErr);
}

[Theory]
[ClassData(typeof(PublishModeTheoryData))]
public async Task RunTestApp_ConfigureMinimumLevelOnly(PublishMode publishMode)
{
var (_, stdOut, stdErr) = await RunTestAppAsync(publishMode, "--minimum-level-only");
stdOut.Should().Be("(Main thread) [Information] Expected success");
stdErr.Should().BeEmpty();
Assert.Equal("(Main thread) [Information] Expected success", stdOut);
Assert.Empty(stdErr);
}

async Task<(bool IsSingleFile, string StdOut, string StdErr)> RunTestAppAsync(PublishMode publishMode, params string[] args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT'">net48</TargetFrameworks>
<TargetFrameworks>$(TargetFrameworks);net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>$(TargetFrameworks);net8.0;net9.0;net10.0</TargetFrameworks>
<DeterministicSourcePaths>false</DeterministicSourcePaths>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>
Expand All @@ -19,17 +19,19 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CliWrap" Version="3.6.7" />
<PackageReference Include="FluentAssertions" Version="6.12.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="NuGet.Frameworks" Version="6.12.1" />
<PackageReference Include="Polly" Version="8.5.0" />
<PackageReference Include="Serilog.Expressions" Version="4.0.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="PublicApiGenerator" Version="11.1.0" />
<PackageReference Include="CliWrap" Version="3.10.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="NuGet.Frameworks" Version="7.0.0" />
<PackageReference Include="Polly" Version="8.6.4" />
<PackageReference Include="Serilog.Expressions" Version="5.0.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageReference Include="PublicApiGenerator" Version="11.5.1" />
</ItemGroup>

<ItemGroup>
Expand Down
11 changes: 6 additions & 5 deletions test/Serilog.Settings.Configuration.Tests/Support/TestApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Text;
using CliWrap;
using CliWrap.Exceptions;
using FluentAssertions;
using Polly;
using Xunit.Abstractions;
using Xunit.Sdk;
Expand Down Expand Up @@ -108,16 +107,18 @@ async Task PublishAsync(PublishMode publishMode)

var executableFileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "TestApp.exe" : "TestApp";
var executableFile = new FileInfo(Path.Combine(outputDirectory.FullName, executableFileName));
executableFile.Exists.Should().BeTrue();
Assert.True(executableFile.Exists);
var dlls = executableFile.Directory!.EnumerateFiles("*.dll");
if (publishMode == PublishMode.Standard)
{
dlls.Should().NotBeEmpty(because: $"the test app was _not_ published as single-file ({publishMode})");
// the test app was _not_ published as single-file
Assert.NotEmpty(dlls);
}
else
{
dlls.Should().BeEmpty(because: $"the test app was published as single-file ({publishMode})");
executableFile.Directory.EnumerateFiles().Should().ContainSingle().Which.FullName.Should().Be(executableFile.FullName);
// the test app was published as single-file
Assert.Empty(dlls);
Assert.Single(executableFile.Directory.EnumerateFiles(), f => f.FullName == executableFile.FullName);
}

_executables[publishMode] = executableFile;
Expand Down
2 changes: 0 additions & 2 deletions test/TestApp-net9.0/.gitignore

This file was deleted.

70 changes: 0 additions & 70 deletions test/TestApp-net9.0/Program.cs

This file was deleted.

Binary file not shown.
Loading