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

System.MissingMethodException: Method not found: 'System.String Perfolizer.Horology.TimeInterval.ToString(System.Globalization.CultureInfo, System.String, Perfolizer.Common.UnitPresentation)' #2358

Closed
jwosty opened this issue Jul 8, 2023 · 7 comments
Milestone

Comments

@jwosty
Copy link

jwosty commented Jul 8, 2023

BenchmarkDotNet was working in my project until recently. Now, my benchmarks are failing with:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.MissingMethodException: Method not found: 'System.String Perfolizer.Horology.TimeInterval.ToString(System.Globalization.CultureInfo, System.String, Perfolizer.Common.UnitPresentation)'.
   at BenchmarkDotNet.Reports.Measurement.ToString()
   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_20.Run(IHost host, String benchmarkName) in /Users/jwostenberg/Code/FSharp.Logf/benchmark/bin/Release/net7.0/07fdf749-2a40-4a4d-a6a9-58c9cdbbb84a/07fdf749-2a40-4a4d-a6a9-58c9cdbbb84a.notcs:line 3618
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at BenchmarkDotNet.Autogenerated.UniqueProgramName.AfterAssemblyLoadingAttached(String[] args) in /Users/jwostenberg/Code/FSharp.Logf/benchmark/bin/Release/net7.0/07fdf749-2a40-4a4d-a6a9-58c9cdbbb84a/07fdf749-2a40-4a4d-a6a9-58c9cdbbb84a.notcs:line 57

BenchmarkDotNet resolved to 0.13.5, and Perfolizer resolved to 0.3.4.

Workaround

Explicitly reference Perfolizer 0.2.1. Looks like a recent version of Perfolizer has a breaking change.

@AndreyAkinshin
Copy link
Member

@jwosty the current stable version of BenchmarkDotNet (v0.13.5) references Perfolizer 0.2.1. You can't use other versions of Perfolizer in the same project. I'm planning to update the Perfolizer reference to the latest version, but it's still an in-progress activity.

BenchmarkDotNet was working in my project until recently.

What changed recently? Do I understand correctly that you added an explicit reference to Perfolizer 0.3.4?

@jwosty
Copy link
Author

jwosty commented Jul 9, 2023

@AndreyAkinshin What changed is that I did a paket install to add some unrelated dependencies to a project, which upgrades everything. I did not explicitly reference Perfolizer; Paket selected the newest version for me, since BenchmarkDotNet has a version constraint of Perfolizer >= 0.2.1 (https://www.nuget.org/packages/BenchmarkDotNet#dependencies-body-tab). I had to add an explicit reference to Perfolizer 0.2.1 to fix the problem.

If BenchmarkDotNet is tied to particular Perfolizer versions, changing the constraint to Perfolizer >= 0.2.1 & < 0.3.0 should prevent wrong versions from being selected.

@AndreyAkinshin AndreyAkinshin added this to the v0.13.6 milestone Jul 9, 2023
@AndreyAkinshin
Copy link
Member

@jwosty thanks for the idea! I have locked the perfolizer reference. The fix will be available in v0.13.6.

@Matthias-Heinz
Copy link

What's the last know good combination of versions for BenchmarkDotNet, BenchmarkDotNet.Annotations and Perfolizer (and possibly their dependencies)?

I'm having trouble getting things running again... Using

  • Perfolizer 0.2.1
  • BenchmarkDotNet 0.13.7
  • BenchmarkDotNet.Annotations 0.13.7
  • Iced 1.20

I'm getting the Runtime Exception
System.IO.FileLoadException: 'Could not load file or assembly 'Perfolizer, Version=0.3.4.0, Culture=neutral, PublicKeyToken=e864f2ec9c0b6d4c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Although the Perfolizer.dll file version in the /bin/Release directory states to be v.0.2.1.0.

Using 0.13.5 or 0.13.6 on both BenchmarkDotNet and BenchmarkDotNet.Annotations doesn't seem to change anything significantly.

@AndreyAkinshin
Copy link
Member

@Matthias-Heinz the correct version of Perfolizer for the latest BenchmarkDotNet (0.13.7) is 0.2.1. I have no idea how you got a reference on 0.3.4. Do you have a repro solution for your problem?

@Matthias-Heinz
Copy link

@AndreyAkinshin During the creation of the sample solution, which is working except for issue #2405, I've managed to track down the issue at hand: My App.config had some reference to version 0.3.4.

      <dependentAssembly>
        <assemblyIdentity name="Perfolizer" publicKeyToken="e864f2ec9c0b6d4c" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-0.3.4.0" newVersion="0.3.4.0" />
      </dependentAssembly>

As for the root cause, I can only speculate: Probably we've had some intermittent version of BenchmarkDotNet installed, which did allow Perfolizer 0.3.4.0 to be used (maybe BenchmarkDotNet 0.13.5 using Perfolizer 0.3.4 as mentioned by @jwosty in this thread). And whilst manually fixing the dependencies during the upgrade to BenchmarkDotNet 0.13.7 (because an automatic update would fail to the higher version of Perfolizer), the App.config did not automatically restrict to Perfolizer 0.2.1.

@AndreyAkinshin
Copy link
Member

@Matthias-Heinz thanks for the update! It seems, there are no additional actions required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants