Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs-logs] Use struct in the complex type logging demo #5577

Merged
merged 9 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/logs/complex-objects/FoodRecallNotice.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

public class FoodRecallNotice
public struct FoodRecallNotice
cijothomas marked this conversation as resolved.
Show resolved Hide resolved
{
public string? BrandName { get; set; }
public string? BrandName { get; init; }

Check failure on line 6 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 6 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 6 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 6 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 6 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 6 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 6 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 6 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 6 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 6 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 6 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 6 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 6 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 6 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 6 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 6 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 6 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

public string? ProductDescription { get; set; }
public string? ProductDescription { get; init; }

Check failure on line 8 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 8 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 8 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 8 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 8 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 8 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 8 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 8 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 8 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 8 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 8 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 8 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 8 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 8 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 8 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 8 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 8 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

public string? ProductType { get; set; }
public string? ProductType { get; init; }

Check failure on line 10 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 10 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 10 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 10 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 10 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 10 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 10 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 10 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 10 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 10 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 10 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 10 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 10 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 10 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 10 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 10 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 10 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

public string? RecallReasonDescription { get; set; }
public string? RecallReasonDescription { get; init; }

Check failure on line 12 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 12 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 12 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 12 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 12 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 12 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 12 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 12 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 12 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 12 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 12 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 12 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 12 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 12 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 12 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

public string? CompanyName { get; set; }
public string? CompanyName { get; init; }

Check failure on line 14 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 14 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 14 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 14 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 14 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 14 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net8.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 14 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 14 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net7.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 14 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 14 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 14 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 14 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net462)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 14 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Check failure on line 14 in docs/logs/complex-objects/FoodRecallNotice.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net6.0)

Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported
}
2 changes: 1 addition & 1 deletion docs/logs/complex-objects/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ internal static partial class LoggerExtensions
[LoggerMessage(LogLevel.Critical)]
public static partial void FoodRecallNotice(
this ILogger logger,
[LogProperties(OmitReferenceName = true)] FoodRecallNotice foodRecallNotice);
[LogProperties(OmitReferenceName = true)] in FoodRecallNotice foodRecallNotice);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in with mutable structs can be tricky. If the compiler can't determine stuff is readonly it will make defensive copies. I think the auto-properties shown here are fine (IIRC the getters get marked as readonly automatically for auto-properties), but users could run into trouble if they handroll more. If we want to recommend in we may also want to recommend the structs be readonly too? readonly struct + in work always.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, updated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build failed, seems it is only available in .NET Core. I'll revert the change.

}
8 changes: 2 additions & 6 deletions docs/logs/complex-objects/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,12 @@ dotnet add package Microsoft.Extensions.Telemetry.Abstractions
Define a new complex data type, as shown in [FoodRecallNotice.cs](./FoodRecallNotice.cs):

```csharp
public class FoodRecallNotice
public struct FoodRecallNotice
{
public string? BrandName { get; set; }

public string? ProductDescription { get; set; }

public string? ProductType { get; set; }

public string? RecallReasonDescription { get; set; }

public string? CompanyName { get; set; }
}
```
Expand All @@ -54,7 +50,7 @@ internal static partial class LoggerExtensions
[LoggerMessage(LogLevel.Critical)]
public static partial void FoodRecallNotice(
this ILogger logger,
[LogProperties(OmitReferenceName = true)] FoodRecallNotice foodRecallNotice);
[LogProperties(OmitReferenceName = true)] in FoodRecallNotice foodRecallNotice);
}
```

Expand Down
1 change: 1 addition & 0 deletions docs/logs/complex-objects/complex-objects.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would put the generated source under .\obj\Debug\net8.0\generated\Microsoft.Gen.Logging\Microsoft.Gen.Logging.LoggingGenerator\Logging.g.cs which helps to understand things behind the scene.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just FYI in case you weren't aware you can see them in IDE under the analyzer:

image

</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Telemetry.Abstractions" />
Expand Down