Is there an easy way to monitor a given Windows process for a well defined .NET exception (either first or second chance) and run a powershell script when that exception is raised? I don't really need a process dump (yet).
How to post-mortem debug .NET process and run powershell script as debugger action?
138 Views Asked by user2368632 At
1
There are 1 best solutions below
Related Questions in POWERSHELL
- How to ignore warning errors?
- Data execution plan ended with error on DB restore
- Powershell Split a file name
- PowerShell EWS Save as for e-mails
- Run SQL Server Update Statement With Powershell
- using a global variable in multiple functions powershell
- Heisenberg was here: Aliases for PowerShell parameters only appear in cmdlet help when you do NOT document the cmdlet
- PowerShell Script to add newuser
- Why is PowerShell "not recognized" when installing Chocolatey?
- Enumerate a PSCustomObject as key/value pairs
- Unable to start program outside Windows folder
- Ask for creds only if some specified
- PowerShell 3 Parameters
- i can't ping a computer but remoting into it works (powershell enter-pssession)
- Feeding Variables in new-aduser -path option in powershell
Related Questions in POSTMORTEM-DEBUGGING
- How do I debug a core dump that aborted in a dlopen()'ed plugin?
- Setting up a postmortem debugger for Windows services
- DebugDiag Crash Rule Does Not Auto-Execute
- Windbg TTD automation
- gdb 7.0 warnings: Wrong size fpregset in core file
- CDB doesn't show the line of code as WinDBG does for callstacks
- windbg conflicting information
- Analyzing a managed callstack from the compact framework
- Getting code line information from program counter only?
- Step execution of release code / post-mortem debugging (VS/C++)
- Identify concrete type of object behind auto_ptr from core dump
- Enabling postmortem debugging on Windows 10
- Post-mortem analysis of Windows Embedded Compact (Windows CE) program
- Debugging a coredump generated by an ASLR enabled system
- Post mortem debugging with the MSVC .map file
Related Questions in DEBUGDIAG
- To find the real function name from DebugDiag memleak report
- .NET - different DebugDiag and perfmon GC Heap size results
- DebugDiag2.0 failed when analyzing the hang issue of asp.net app
- memory issues on a native c++ app on windows
- Debugdiag on a .NET program - Leak Probability
- DebugDiag reports a thread is calling GC.Cleanup too often. What process spawned that thread?
- Getting additional call function information with debugdiag
- Troubleshooting native memory leaks in Windows Store applications using DebugDiag and LeakTrack
- How to use DebugDiag now that Internet Explorer is deprecated?
- How to get DebugDiag to show method names in the stack trace?
- Memory leak when using UI Automation in Windows 10
- How to know the OperationContract was called by request using debug diagnostic tool
- IIS Application Pool Crashing - Safe handle has been closed - IAsync
- Error while using DebugDiag for debugging dump file
- DebugDiag dump doesn't include a .NET exception, depending on certain code
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
.NET application errors are logged to the Application Events Log. In the Scheduled Task manager, we can add a task which is triggered by a .NET Runtime exception event.
In practice, this is a bit troublesome to do by hand, since we need some additional
ValueQueriesto make this work, I've made a task XML which can be imported into the Task Scheduler. See this gist.The task needs to call our PowerShell script with an
EventId, from which we retrieve the corresponding event log item, check the message for the stacktrace, and search for the matching known exception string.Once the task is enabled, every time your .NET application faults, the PowerShell script should be run.