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

how to debug reflection error #1933

Closed
MarshalOfficial opened this issue Mar 6, 2022 · 5 comments
Closed

how to debug reflection error #1933

MarshalOfficial opened this issue Mar 6, 2022 · 5 comments
Milestone

Comments

@MarshalOfficial
Copy link

MarshalOfficial commented Mar 6, 2022

Hi there, I got this error when running my benchmark console application:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.NotSupportedException: Unknown Acknowledgment: cknowledgment
   at BenchmarkDotNet.Engines.ConsoleHost.SendSignal(HostSignal hostSignal)
   at BenchmarkDotNet.Engines.HostExtensions.BeforeMainRun(IHost host)
   at BenchmarkDotNet.Engines.Engine.Run()
   at BenchmarkDotNet.Autogenerated.Runnable_0.Run(IHost host, String benchmarkName) in D:\path\path\path\project-name\bin\Release\net5.0\905bb547-33f1-4501-898b-08ad67d64091\905bb547-33f1-4501-898b-08ad67d64091.notcs:line 169
   --- 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 System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at BenchmarkDotNet.Autogenerated.UniqueProgramName.AfterAssemblyLoadingAttached(String[] args) in D:\path\path\path\project-name\bin\Release\net5.0\905bb547-33f1-4501-898b-08ad67d64091\905bb547-33f1-4501-898b-08ad67d64091.notcs:line 51

How can I detect the problem?
My code is:

public class GetAccountBalanceBenchmark
    {
        [Benchmark]
        public async Task RUN() 
        {
            var _ = await Core.Sdk.GetAccountBalance(new SDK.Models.GetAccountBalanceModel { Id = "10", IdType = Codec.IdType.ACCOUNT });            
        }
    }
@adamsitnik
Copy link
Member

Hi @MarshalOfficial

Is there any chance that your benchmark is printing anything to the console?

Which BDN, .NET and OS versions are you using?

@MarshalOfficial
Copy link
Author

Hi @adamsitnik

In the case of console logs, it prints starting benchmark then build in release mode and tried to run my project, but after that, it makes this reflection error.

My project is a console application via dotnet 5, my OS is Win10 and IDE is VS.

Also, the project is about connecting to an Aeron server via a Java media driver and communicating with that.
In my source code, I have an Init function that tries to write an embedded Jar file from the project's resource and then starts some threads to run that jar file via a batch file and connect to Aeron context and send/receive messages.

@adamsitnik
Copy link
Member

@MarshalOfficial Sorry for not making myself clear, is your code (what you are benchmarking, not BenchmarkDotNet itself) printing anything to the console?

Example:

[GlobalSetup]
public void Print() => Console.WriteLine("Setup!");

Which BenchmarkDotNet version are you using?

Are you able to consistently repro this issue?

@MarshalOfficial
Copy link
Author

@adamsitnik Thank you for following up

Yes, my project itself logs on the console a lot.

BenchmarkDotNet package version was: 0.13.1 Latest Stable

Unfortunately, I was not able to get a benchmark successfully at all, and it gives the same error every time.

@adamsitnik
Copy link
Member

Unfortunately, I was not able to get a benchmark successfully at all, and it gives the same error every time.

#2092 should have fixed this error. You can try our preview version from BDN CI feed:

https://benchmarkdotnet.org/articles/guides/nuget.html#nightly

@adamsitnik adamsitnik added this to the v0.13.3 milestone Oct 5, 2022
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

2 participants