Thursday, March 18, 2010

Debug::assert

This method allows to check if some Boolean condition evaluates to true and if it doesn't - stop further execution and show stack trace. Debug::assert() should be used to validate some assumptions made in the code which should never happen if nothing is broken in the application. It means that wrong user input should not be asserted but rather validated by normal if statement and exception should be thrown if the input is wrong. However, if the code relies, for example, on query data source name, which can be broken only in development time - that is a good place to add assert to.

Example:
    Query query = new Query(querystr(Alertsetup));
    QueryBuildDataSource qbds;
    ;

    qbds = query.dataSourceName(identifierstr(EventRule));
    Debug::assert(qbds != null);

23 comments:

  1. We jsut converted our first customer to Ax2009. Over and over again the users get a message taht the debugger is not installed. If we run the same code on a machine with a debugger installed the debugger opens up and halts on a debug::assert line.
    BUT...the "Debug mode" option i Options is set to No. How the heck can we get away from this?

    ReplyDelete
  2. That is strange. I've verified that setting debug mode to no disables asserts.
    I'll try to look more into what else can cause that.

    ReplyDelete
  3. Thank you for the article. Being the owner of an online motorcycle ecommerce website,
    I found it of value to read your ideas about this topic. Please continue
    the great work.

    Visit my blog post biker jeans

    ReplyDelete
  4. Your mode of explaining everything in this piece
    of writing is really fastidious, every one be capable of
    easily know it, Thanks a lot.

    Here is my blog - thetahealing

    ReplyDelete
  5. Appreciatinmg thee dedication you put into your site
    and detailed information you provide. It's good to come across a blog every once in a while that isn't the same old rehashed material.
    Wonderful read! I've saved your site and I'm including your RSS feeds tto
    my Google account.

    Here is my homepage - stamped Concrete

    ReplyDelete
  6. This website certainly has all of the information and facts I needed about this subject and didn't know who to ask.


    Look at my webpage ... Chapter 13 Bankruptcy

    ReplyDelete
  7. Very good blog you have hhere but I was wondering if you knew of any discussion boards that cover thee
    same topics discussed in this article? I'd really
    love to be a part of community where I can geet opinions from
    other experienced individuals that share the same interest.

    If you have any recommendations, please let me know. Cheers!


    My blog game of war fire age cheat tool

    ReplyDelete
  8. Good way of describing, and fastidious piece of writing to get facts about my presentation topic, which i
    am going to convey in academy.

    Visit my blog Emergency Get A Payday Loan With No Faxing

    ReplyDelete
  9. The Vintage Wholesale Company The Vintage Wholesale Company.Walson Rockabilly are a vintage wholesale company who focus on vintage fashion wholesale. WalsonRockabilly Vintage Clothing wholesalers are the UK's leading,Shop wholesale vintage dress, xxxx silk dress, vintage jewelry products from reliable vintage dress wholesalers on walsonrockabilly and get worldwide,We know wholesale vintage clothing. We're the only vintage clothing wholesaler that knows what it's like to be in your shoes,because we run stores ourselves.Always Vintage is a Wholesale Vintage Clothing Distributor. We offer more than ninety different categories of vintage clothing for you to choose from.Swing Dresses
    Rockabilly Dresses
    Retro Dresses

    ReplyDelete