Skip to content

JIL benchmark fails due to AmbiguousMatchException #4422

Open
@adamsitnik

Description

Repro:

py .\scripts\benchmarks_ci.py -f net9.0 --filter *Json_FromString<Location>.Jil*

Error msg:

 // Benchmark Process Environment Information:
 // BenchmarkDotNet v0.13.13-nightly.20240311.145
 // Runtime=.NET 9.0.0 (9.0.24.42603), X64 RyuJIT AVX2
 // GC=Concurrent Workstation
 // HardwareIntrinsics=AVX2,AES,BMI1,BMI2,FMA,LZCNT,PCLMUL,POPCNT VectorSize=256
 // Job: Job-XUBORB(PowerPlanMode=00000000-0000-0000-0000-000000000000, IterationTime=250ms, MaxIterationCount=20, MinIterationCount=15, WarmupCount=1)

 OverheadJitting  1: 1 op, 216300.00 ns, 216.3000 us/op

 System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
  ---> Jil.DeserializationException: The type initializer for 'Jil.Deserialize.InlineDeserializer`1' threw an exception.
  ---> System.TypeInitializationException: The type initializer for 'Jil.Deserialize.InlineDeserializer`1' threw an exception.
  ---> System.Reflection.AmbiguousMatchException: Ambiguous match found for 'System.TimeSpan System.TimeSpan FromSeconds(Int64)'.
    at System.RuntimeType.GetMethodImplCommon(String name, Int32 genericParameterCount, BindingFlags bindingAttr, Binder binder, CallingConventions callConv, Type[] types, ParameterModifier[] modifiers)
    at System.Type.GetMethod(String name, BindingFlags bindingAttr)
    at Jil.Deserialize.InlineDeserializer`1..cctor()
    --- End of inner exception stack trace ---
    at Jil.Deserialize.InlineDeserializer`1.AddGlobalVariables()
    at Jil.Deserialize.InlineDeserializer`1.BuildWithNew(Type forType)
    at Jil.Deserialize.InlineDeserializer`1.BuildFromStringWithNewDelegate(Int32& approximateILCount)
    at Jil.Deserialize.InlineDeserializerHelper.BuildFromString[ReturnType](Type optionsType, DateTimeFormat dateFormat, SerializationNameFormat serializationNameFormat, Exception& exceptionDuringBuild)
    at Jil.Deserialize.TypeCache`2.LoadFromString()
    at Jil.Deserialize.TypeCache`2.GetFromString()
    at Jil.JSON.GetDeserializeStringThunkDelegate[T](Options options)
    at Jil.JSON.Deserialize[T](ReadOnlySequence`1 sequence, Options options)
    --- End of inner exception stack trace ---
    at Jil.JSON.Deserialize[T](ReadOnlySequence`1 sequence, Options options)
    at Jil.JSON.Deserialize[T](String text, Options options)
    at MicroBenchmarks.Serializers.Json_FromString`1.Jil_() in D:\projects\performance\src\benchmarks\micro\Serializers\Json_FromString.cs:line 29
    at BenchmarkDotNet.Autogenerated.Runnable_0.WorkloadActionNoUnroll(Int64 invokeCount) in D:\projects\performance\artifacts\bin\MicroBenchmarks\Release\net9.0\89a12b0c-b350-4b60-b2dd-62bbe20fd793\89a12b0c-b350-4b60-b2dd-62bbe20fd793.notcs:line 317
    at BenchmarkDotNet.Engines.Engine.RunIteration(IterationData data)
    at BenchmarkDotNet.Engines.EngineFactory.Jit(Engine engine, Int32 jitIndex, Int32 invokeCount, Int32 unrollFactor)
    at BenchmarkDotNet.Engines.EngineFactory.CreateReadyToRun(EngineParameters engineParameters)
    at BenchmarkDotNet.Autogenerated.Runnable_0.Run(IHost host, String benchmarkName) in D:\projects\performance\artifacts\bin\MicroBenchmarks\Release\net9.0\89a12b0c-b350-4b60-b2dd-62bbe20fd793\89a12b0c-b350-4b60-b2dd-62bbe20fd793.notcs:line 180
    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.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
    at BenchmarkDotNet.Autogenerated.UniqueProgramName.AfterAssemblyLoadingAttached(String[] args) in D:\projects\performance\artifacts\bin\MicroBenchmarks\Release\net9.0\89a12b0c-b350-4b60-b2dd-62bbe20fd793\89a12b0c-b350-4b60-b2dd-62bbe20fd793.notcs:line 57

@tarekgh this may be a product issue, not benchmark issue (the NuGet package got updated 3 years ago in #1891)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions