Open sandboxFocusImprove this doc

PS0272: PostSharp Is Waiting for a Debugger

Severity Warning
Reported by PostSharp
Message Waiting for a debugger to be attached. PID=<ProcessId>.

Cause

When the PostSharpAttachDebugger MSBuild property is True, the compiler of PostSharp breaks before it builds the project, so that you can debug the build-time code of your aspects. When a just-in-time debugger is installed, PostSharp launches it. Otherwise, PostSharp reports PS0272 and waits until a debugger is attached to the process, or until the build is canceled. <ProcessId> is the identifier of the process of the compiler.

By default, PostSharp assumes that a just-in-time debugger is installed on Windows, except in a container, and that none is installed on other operating systems. The HAS_JIT_DEBUGGER environment variable overrides this assumption.

The message makes the build wait for a debugger, so no example can show it.

Resolution

  • To debug the build, attach a debugger to the process <ProcessId>: in Visual Studio, select Debug > Attach to Process; in Visual Studio Code or Rider, use the command that attaches to a .NET process. The build resumes once the debugger is attached. See Debugging Build-Time Logic.
  • When you do not want to debug the build, remove the PostSharpAttachDebugger property from the project, from Directory.Build.props and from the command line, or set it to False, and cancel the waiting build.
  • On Windows with a just-in-time debugger installed but not detected, for example in a container, set the HAS_JIT_DEBUGGER environment variable to True so that PostSharp launches it. See Well-Known Environment Variables.

See Also

Other Resources

Debugging Build-Time Logic
Well-Known MSBuild Properties
Well-Known Environment Variables