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 6678547
In Process

The Archive Base Latest Questions

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

I have implemented a custom TraceListener which both logs the messages sent to method

  • 0

I have implemented a custom TraceListener which both logs the messages sent to method Write and outputs them to the Win32 trace, using the Win32 API function OutputDebugString. Whenever my application uses System.Diagnostics.Debug.Write or System.Diagnostics.Trace.Write, the messages get properly handled by the trace listener.

However, if my application runs into an assertion such as System.Diagnostics.Debug.Assert I would like to intercept what is sent to the debug output. Somehow, the trace listener does not get called with the messages produced by the assert. Is this possible? Or do I have to provide my own implementation of Assert in order for this to work?

  • 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-26T04:15:24+00:00Added an answer on May 26, 2026 at 4:15 am

    Are you building in Release mode? Debug.Assert has the ConditionalAttribute for the DEBUG symbol defined so the calls are removed by compiler in Release mode.

    Debug.Assert calls the Fail method on your trace listener. Is that implemented correctly? If you haven’t overridden it, then it defaults to calling WriteLine prepended with “Fail: “.

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

Sidebar

Related Questions

I have implemented a custom ActionMapper which obtains the locale from the URI (the
I have implemented a custom list view which looks like the twitter timeline. adapter
I have successfully implemented a custom SimpleCursorAdapter for an AutoCompleteTextView, which suggests entries from
I have implemented a custom trace listener (derived from TextWriteTraceListener ) and now I
I have implemented a custom UITableViewCell which includes a UITextView that auto-resizes as the
I have implemented a custom designer class which inherits from DocumentDesigner. The standard Form
I'm trying to write a custom trace listener for Enterprise Library Logging which sends
I have a custom component where I have implemented INotifyPropertyChanged and IBindableComponent . However,
I have implemented custom errors in my asp.net mvc application by following this article
I have implemented custom draw for an CTreeCtrl in my MFC Smart Device program.

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.