dotnet / docker-tools

This is a repo to house some common tools for our various docker repos.
MIT License
122 stars 46 forks source link

updateImageSizeBaseline fails with "Property with the same name already exists on object" #1243

Open MichaelSimons opened 5 months ago

MichaelSimons commented 5 months ago

Found as part of https://github.com/dotnet/dotnet-docker/pull/5359.

Steps to reproduce in dotnet-docker nightly branch

.\tests\performance\Validate-ImageSize.ps1 -UpdateBaselines -ImageBuilderCustomArgs "--os-version azurelinux3.0"

Results

Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.ArgumentException: Can not add property src/runtime-deps/8.0/azurelinux3.0/amd64 to Newtonsoft.Json.Linq.JObject. Property with the same name already exists on object.
   at Newtonsoft.Json.Linq.JObject.ValidateToken(JToken o, JToken existing)
   at Newtonsoft.Json.Linq.JContainer.InsertItem(Int32 index, JToken item, Boolean skipParentCheck, Boolean copyAnnotations)
   at Newtonsoft.Json.Linq.JObject.InsertItem(Int32 index, JToken item, Boolean skipParentCheck, Boolean copyAnnotations)
   at Newtonsoft.Json.Linq.JContainer.TryAddInternal(Int32 index, Object content, Boolean skipParentCheck, Boolean copyAnnotations)
   at Newtonsoft.Json.Linq.JContainer.Add(Object content)
   at Newtonsoft.Json.Linq.JObject.Add(String propertyName, JToken value)
   at Microsoft.DotNet.ImageBuilder.Commands.UpdateImageSizeBaselineCommand.<>c__DisplayClass5_0.<UpdateBaseline>g__processImage|0(String repoId, String imageId, String imageTag, String platform) in /image-builder/src/Commands/UpdateImageSizeBaselineCommand.cs:line 83
   at Microsoft.DotNet.ImageBuilder.Commands.ImageSizeCommand`2.ProcessImages(ImageHandler processImage) in /image-builder/src/Commands/ImageSizeCommand.cs:line 39
   at Microsoft.DotNet.ImageBuilder.Commands.UpdateImageSizeBaselineCommand.UpdateBaseline() in /image-builder/src/Commands/UpdateImageSizeBaselineCommand.cs:line 87
   at Microsoft.DotNet.ImageBuilder.Commands.UpdateImageSizeBaselineCommand.ExecuteAsync() in /image-builder/src/Commands/UpdateImageSizeBaselineCommand.cs:line 31
   at Microsoft.DotNet.ImageBuilder.Commands.Command`2.<GetCliCommand>b__9_0(TOptions options) in /image-builder/src/Commands/Command.TOptions.cs:line 46
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()

I was expecting this to work. If not intended to work, I would have expected a meaningful message.

dotnet-issue-labeler[bot] commented 5 months ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.