Debug.Assert seems not to work in Mono
Posted
by
Jan-Willem
on Stack Overflow
See other posts from Stack Overflow
or by Jan-Willem
Published on 2011-11-23T16:03:54Z
Indexed on
2011/11/23
17:50 UTC
Read the original article
Hit count: 200
Consider the following C# program:
using System;
using System.Diagnostics;
namespace Test
{
class MainClass
{
public static void Main (string[] args)
{
Debug.Assert(false);
Debug.Fail("fail!");
Console.WriteLine ("Hello World!");
}
}
}
When compiling this using:
dmcs -debug -d:DEBUG Main.cs
and then running it with:
mono --debug Main.exe
the assertion and fail seem to be ignored. The output is just:
Hello World!
I checked other related questions on StackOverflow, but I could not find a solution. In particular the solution give in Mono - Debug.Assert does not work does not work. (UPDATE: the update solution does work, see below comments.)
I use Mono 2.1.5-1 on Ubuntu 11.10.
© Stack Overflow or respective owner