Skip to content

Exception While Running Native Benchmark #1

Description

@Mike-E-angelo

Hello,

I saw in your excellent blog post the use of the benchmarks here. When checking out the code, however, there seems to be a NativeEnumerable benchmark that is not discussed in the blog post. Not that I can see, at least.

This. of course, gets me curious to download the code and try it out to see how it fares with the others. Unfortunately, it results in an exception which I will provide here:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.SEHException: External component has thrown an exception.
   at SpanSample.Native.StreamRead(NativeStreamHandle stream, Int32& buffer, UIntPtr size)
   at SpanSample.NativeEnumerable.Enumerator.MoveNext() in C:\Users\..\Downloads\SpanSample-master\SpanSample\NativeEnumerable.cs:line 54
   at SpanSample.EnumerationBenchmarks.NativeEnumerable() in C:\Users\..\Downloads\SpanSample-master\SpanSample\EnumerationBenchmarks.cs:line 156
   at BenchmarkDotNet.Autogenerated.Runnable_0.WorkloadActionNoUnroll(Int64 invokeCount) in C:\Users\..\Downloads\SpanSample-master\SpanSample\bin\Release\netcoreapp2.1\bded5edd-b23b-45eb-8855-ac509f2a26ce\bded5edd-b23b-45eb-8855-ac509f2a26ce.notcs:line 466
   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) in C:\Users\..\Downloads\SpanSample-master\SpanSample\bin\Release\netcoreapp2.1\bded5edd-b23b-45eb-8855-ac509f2a26ce\bded5edd-b23b-45eb-8855-ac509f2a26ce.notcs:line 143
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at BenchmarkDotNet.Autogenerated.UniqueProgramName.AfterAssemblyLoadingAttached(String[] args) in C:\Users\..\Downloads\SpanSample-master\SpanSample\bin\Release\netcoreapp2.1\bded5edd-b23b-45eb-8855-ac509f2a26ce\bded5edd-b23b-45eb-8855-ac509f2a26ce.notcs:line 59

A couple other notes:

  • I had to update the Windows SDK to a newer version
  • Same with some Nuget packages (expected of course)
  • When switching to Release mode, the x64 path was not there and results in an exception when trying to copy Native. It turns out that Release mode is set to Win32 for the Native project. I am not sure if this is due to updating the SDK, however (I am not very familiar with C++ projects).

Otherwise, this is extremely valuable and informative. Thank you for putting this together!
-Michael

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions