Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6812887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:30:15+00:00 2026-05-26T20:30:15+00:00

I had a problem in code that caused a Debug.Fail to be called. I

  • 0

I had a problem in code that caused a Debug.Fail to be called. I use Debug.Assert and Debug.Fail quite a lot, since it not only gives me instant notification that a problem exists, but also information about what and where the problem is located.

But this time the Debug.Fail itself caused an even bigger problem, since the UI (WPF) froze becuse of the following error:

Dispatcher processing has been suspended, but messages are still being processed.

Is there anything I can do to make Debug.Fail succeed? I most definitely do not want to have code around by Debug.Fail to check whether to Invoke or BeginInvoke.

EDIT: I suppose replacing the DefaultTraceListener would do the trick?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:30:16+00:00Added an answer on May 26, 2026 at 8:30 pm

    Debug.Fail will by default use the DefaultTraceListener. Using ILSpy, I could see that DefaultTraceListener.Fail makes a call to AssertWrapper.ShowAssert. To get around the problem, replace the DefaultTraceListener with your own that has Dispatcher guards around the call to AssertWrapper.ShowAssert.

    Voila! Now you can call Debug.Assert and Debug.Fail without bothering about dispatcher issues.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Many months back, I had to fix up some code that caused some problems.
I had no problem at all running the following code on a local server,
In another question I had the problem to port the code: unsigned long stack[]
While I was investigating a problem I had with lexical closures in Javascript code,
I had a weird problem, where I opened up a source code project for
I'm having a problem with some code I've written. I've had to anonymize it,
I had a problem that was partially solved. To explain it quickly : I
I have some code that I had to write to replace a function that
I just had a pretty painful troubleshooting experience in troubleshooting some code that looked
I recently stumbled over a problem caused by some very old code I wrote

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.