Search code examples
c#azuredebuggingxdebugazure-worker-roles

Can't debug worker role (emulator)


I have created worker role in VisualStudio 2015 AZURE SDK 2.9, C#

i added breakpoints to start of the each method:

    public override void Run()
    {

    public override bool OnStart()
    {

    private async Task RunAsync( CancellationToken cancellationToken )
    {

but when i start my application in debug mode none of these breakpoints hits. In emulator i see this messages:

[fabric] Role Instance: deployment29(49).Channels.Jobs.Integr.Sync.Jobs.0

[fabric] Role state Started

[runtime] Role entrypoint . CALLING OnStart():Integr.Sync.Jobs.DistributedJobRole

[runtime] Role entrypoint . COMPLETED OnStart(): Integr.Sync.Jobs.DistributedJobRole

[runtime] Role entrypoint . CALLING Run():Integr.Sync.Jobs.DistributedJobRole

what I'm doing wrong? how to stop worker role on breakpoints?


Solution

  • After small investigation i found the root of the problem:

    after changing role class from:

    public class IntegrationsSyncRole: RoleEntryPoint
    

    to

    public class IntegrationsSyncRole: DistributedJobRole
    ...
    public class DistributedJobRole: RoleEntryPoint
    

    breakpoints stopped hitting.

    Solution was to remove intermediate class and inherit IntegrationsSyncRole from RoleEntryPoint without any other classes.