Skip to content

Unhandled exception can cause TopshelfRoleEntryPoint to throw ObjectDisposedException. #3

@rhencke

Description

@rhencke

If a service hosted with TopshelfRoleEntryPoint throws an unhandled exception, this can cause TopshelfRoleEntryPoint to throw an ObjectDisposedException, as follows.

Our best guess as to the erring line is https://github.com/Topshelf/Topshelf.Azure/blob/master/src/Topshelf.Azure/TopshelfRoleEntryPoint.cs#L126

Application: WaWorkerHost.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ObjectDisposedException
Stack:
   at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean ByRef)
   at Microsoft.Win32.Win32Native.SetEvent(Microsoft.Win32.SafeHandles.SafeWaitHandle)
   at System.Threading.EventWaitHandle.Set()
   at Topshelf.TopshelfRoleEntryPoint.OnStop()
   at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.StopRoleInternal()
   at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.<StopRole>b__4()
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ThreadHelper.ThreadStart()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions