Error while running Controller through API

Questions about YourKit .NET Profiler
Post Reply
ankushb
Posts: 4
Joined: Wed Jul 22, 2009 6:32 am

Error while running Controller through API

Post by ankushb »

Hi,

I was trying to run yourkit profiler through api. The problem is when I try to instantiate new Controller object using
Controller controller = new Controller();

Its giving runtime error
Unhandled Exception: System.Exception: To use the profiler API, run the application with YourKit Profiler
at YourKit.Profiler.Api.AgentPortRetriever.getNetAgentPort()
at YourKit.Profiler.Api.Controller..ctor()

YourKit.Profiler.Api.Dll is in the refernece path. Am i missing some other reference? I am using VS2008 on vista.

Thanks
Ankush
Vladimir Kondratyev
Posts: 1624
Joined: Tue Aug 10, 2004 7:52 pm

Re: Error while running Controller through API

Post by Vladimir Kondratyev »

The exception text says "To use the profiler API, run the application with YourKit Profiler". It doesn't mean that you need to have profiler agent in PATH. It means that the current process itself should be launched with profiler agent. Please refer the help. If you write an application which doesn't run with profiler agent itself, but controls profiling in other application, you should use Controller(String, Int32) constructor.
ankushb
Posts: 4
Joined: Wed Jul 22, 2009 6:32 am

Re: Error while running Controller through API

Post by ankushb »

Sorry to bother you again, When I am adding yourkit.api.dll as reference in my project(note its not console application, it doesn't generate the exe rather generate the dll which is used by another application) VS2008 is giving error "Assembly generation failed -- Referenced assembly 'YourKit.Profiler.Api' does not have a strong name". How to get rid of this?
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Error while running Controller through API

Post by Anton Katilin »

Hello,

Please try the following dll:

http://www.yourkit.com/download/tmp/200 ... er.Api.dll

Does it solve the problem?

Best regards,
Anton
ankushb
Posts: 4
Joined: Wed Jul 22, 2009 6:32 am

Re: Error while running Controller through API

Post by ankushb »

Using this dll code gets compiled but while starting the controller it is giving error

Error while starting profiler
System.IO.FileLoadException: Could not load file or assembly 'YourKit.Profiler.Api, Version=4.0.7.420, Culture=neutral, PublicKeyToken=14709304d0c5eb15' or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418)
File name: 'YourKit.Profiler.Api, Version=4.0.7.420, Culture=neutral, PublicKeyToken=14709304d0c5eb15' ---> System.Security.Policy.PolicyException: Execution permission cannot be acquired.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Error while running Controller through API

Post by Anton Katilin »

We're investigating. We'll provide you with an update ASAP.
ankushb
Posts: 4
Joined: Wed Jul 22, 2009 6:32 am

Re: Error while running Controller through API

Post by ankushb »

Thats was the caspol issue i think, after adding entry in that made code to work
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Error while running Controller through API

Post by Anton Katilin »

Could you please confirm that we can close this issue as resolved?
Post Reply