-
Notifications
You must be signed in to change notification settings - Fork 418
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
Generate metadata in manifest. #1619
Conversation
/// <summary> | ||
/// Value of metadata entry. | ||
/// </summary> | ||
public object Value { get; } = value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On hold for now but based on latest offline chat we might still allow object serialization.
@davidfowl merge conflict resolved. This metadata PR was ready to go in unless you can spot some issues with the current implementation. |
foreach (var metadataAnnotation in metadataAnnotations) | ||
{ | ||
Writer.WritePropertyName(metadataAnnotation.Name); | ||
JsonSerializer.Serialize(Writer, metadataAnnotation.Value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RIP AOT 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably inject a serializer via DI here but TBH it don't think anyone would be doing AOT on their app host, given the product we are shipping for GA there is no reason to wait for the native build when you just want to launch the app to either debug locally or produce a manifest.
/// <returns>Resource builder.</returns> | ||
public static IResourceBuilder<T> WithMetadata<T>(this IResourceBuilder<T> builder, string name, object value) where T: IResource | ||
{ | ||
var existingAnnotation = builder.Resource.Annotations.OfType<ManifestMetadataAnnotation>().SingleOrDefault(a => a.Name == name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to end up killed our perf when we do testing 😄.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can think of a many over engineered solutions which I'll be happy to implement once we get some good data on where our perf pain is.
Fixes: #1959
This PR adds infrastructure to support emitting a
"metadata":
property for resources in the manifest. The usage is as follows:The manifest would look like this:
Metadata properties use the JSON serializer on the value field so they can be simple types such as strings, booleans, and integers, but they can also be complex objects.
Microsoft Reviewers: Open in CodeFlow