Skip to content

Commit

Permalink
bump to net8 and fix #438 (#442)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mpdreamz committed Sep 18, 2024
1 parent 2f9d18c commit b5a96d2
Show file tree
Hide file tree
Showing 33 changed files with 73 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/.github.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>False</IsPackable>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MinVer" Version="2.3.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net461" Version="1.0.2" PrivateAssets="all"/>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net461" Version="1.0.3" PrivateAssets="all"/>
</ItemGroup>
</Project>
14 changes: 7 additions & 7 deletions build/scripts/CommandLine.fs
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ type Arguments =
interface IArgParserTemplate with
member this.Usage =
match this with
| Clean _ -> "clean known output locations"
| Build _ -> "Run build"
| Test _ -> "Run all the unit tests"
| Integrate _ -> "Run all the integration tests "
| Release _ -> "runs build, tests, and create and validates the packages shy of publishing them"
| Publish _ -> "Runs the full release"
| Clean -> "clean known output locations"
| Build -> "Run build"
| Test -> "Run all the unit tests"
| Integrate -> "Run all the integration tests "
| Release -> "runs build, tests, and create and validates the packages shy of publishing them"
| Publish -> "Runs the full release"

| SingleTarget _ -> "Runs the provided sub command without running their dependencies"
| Token _ -> "Token to be used to authenticate with github"
| Commit _ -> "Commit hash to be used to fetch the logging spec"
| CleanCheckout _ -> "Skip the clean checkout check that guards the release/publish targets"
| UpdateSpec _ -> "Updates the logging spec"
| UpdateSpec -> "Updates the logging spec"
| PristineCheck
| GeneratePackages
| ValidatePackages
Expand Down
2 changes: 1 addition & 1 deletion build/scripts/scripts.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion docs/docs.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>False</IsPackable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
5 changes: 1 addition & 4 deletions examples/aspnetcore-with-extensions-logging/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();

builder.Host.ConfigureLogging((_, loggingBuilder) =>
{
loggingBuilder.AddElasticsearch(client.Transport, log =>
builder.Logging.AddElasticsearch(client.Transport, log =>
{
log.Tags = new[] { "debug" };
}, channel =>
{
channel.ExportResponseCallback = (response, buffer) => Console.WriteLine($"Written {buffer.Count} logs to Elasticsearch: {response.ApiCallDetails.HttpStatusCode}");
});
});
var app = builder.Build();

app.UseAuthorization();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>aspnetcore_with_extensions_logging</RootNamespace>
Expand Down
2 changes: 1 addition & 1 deletion examples/aspnetcore-with-serilog/AspnetCoreExample.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion examples/playground/playground.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
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": "6.0.302",
"version": "8.0.302",
"rollForward": "latestFeature",
"allowPrerelease": false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/*
IMPORTANT NOTE
==============
This file has been generated.
This file has been generated.
If you wish to submit a PR please modify the original csharp file and submit the PR with that change. Thanks!
*/

Expand Down Expand Up @@ -63,5 +63,7 @@ namespace Elastic.CommonSchema.Serialization;
[JsonSerializable(typeof(Vlan))]
[JsonSerializable(typeof(Vulnerability))]
[JsonSerializable(typeof(X509))]
[JsonSerializable(typeof(LogEntityJsonConverter.LogOriginInvalid))]
[JsonSerializable(typeof(LogEntityJsonConverter.LogFileOriginInvalid))]
[JsonSourceGenerationOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
internal partial class EcsJsonContext : JsonSerializerContext { }
internal partial class EcsJsonContext : JsonSerializerContext { }
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ internal partial class EcsEntityJsonConverter

internal partial class LogEntityJsonConverter
{
private class LogFileOriginInvalid
internal class LogFileOriginInvalid
{
[JsonPropertyName("name"), DataMember(Name = "name")]
public string? Name { get; set; }

[JsonPropertyName("line"), DataMember(Name = "line")]
public int? Line { get; set; }
}
private class LogOriginInvalid
internal class LogOriginInvalid
{
[JsonPropertyName("function"), DataMember(Name = "function")]
public string? Function { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Specification/Specification.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>False</IsPackable>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>NLog.Targets.Elastic.IntegrationTests</RootNamespace>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<IsTestProject>False</IsTestProject>
<Nullable>enable</Nullable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<OutputType>Library</OutputType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/Elastic.Apm.NLog.Tests/Elastic.Apm.NLog.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
<NoWarn>NU1701</NoWarn>
Expand Down
4 changes: 2 additions & 2 deletions tests/Elastic.CommonSchema.NLog.Tests/MessageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void SerializesKnownBadObject() => TestLogger((logger, getLogEvents) =>
var ecsEvents = ToEcsEvents(logEvents);
var (_, info) = ecsEvents.First();
info.Message.Should().StartWith("Info {\"MethodInfoProperty");
info.Message.Should().StartWith("Info {\"TypeProperty");
info.Metadata.Should().ContainKey("EvilValue");
var x = info.Metadata["EvilValue"] as Dictionary<string, object>;
Expand All @@ -167,7 +167,7 @@ public void SerializesObjectThatThrowsOnGetter() => TestLogger((logger, getLogEv
var ecsEvents = ToEcsEvents(logEvents);
var (_, info) = ecsEvents.First();
info.Message.Should().StartWith("Info {\"MethodInfoProperty");
info.Message.Should().StartWith("Info {\"TypeProperty");
info.Metadata.Should().NotContainKey("EvilValue");
info.Metadata.Should().ContainKey("__failures__");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
<NoWarn>SYSLIB1015;SYSLIB1014</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
30 changes: 30 additions & 0 deletions tests/Elastic.CommonSchema.Tests/Repro/GithubIssue438.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using FluentAssertions;
using Xunit;

namespace Elastic.CommonSchema.Tests.Repro
{
public class GithubIssue438
{
[Fact]
public void Reproduce()
{
// language=json
var json =
"""
{
"@timestamp":"2022-11-08T09:36:37.249Z",
"log.level":"info",
"message":"['vo_phi_pkg\\\\runtime_recon.py']",
"ecs":{"version":"1.6.0"},
"log":{
"logger":"root",
"origin":{"file":{"line":90,"name":"main.py"},"function":"prepare_logging"},
"original":"['vo_phi_pkg\\\\runtime_recon.py']"},
"process":{"name":"MainProcess","pid":35436,"thread":{"id":13180,"name":"MainThread"}}
}
""";
var entry1 = System.Text.Json.JsonSerializer.Deserialize<EcsDocument>(json);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>False</IsPackable>
<SignAssembly>False</SignAssembly>
<PreserveCompilationContext>true</PreserveCompilationContext>
Expand Down

0 comments on commit b5a96d2

Please sign in to comment.