Conditional not working, C# Express beta 2 && the editor to post this error also fails
This code example from help doesnt work; Msg is called every time.
AND, the web page editor to post this code also fails, with this messagebox:
Line 188
Char 1
Error: '_ctl0_Maincontent__ctl0_PostForm_PostBodyRichText_Toolba...' is undefined
Code 0
Url .../AddPost.aspx?ForumID=59
| |
// cs_attribute_conditional.cs using System;using System.Diagnostics;public classTrace{ [ Conditional("DEBUG")]publicstaticvoid Msg(string msg){ Console.WriteLine(msg);} } class Test{ staticvoid A( ){ Trace.Msg("Now in A.");B( ); } staticvoid B( ){ Trace.Msg("Now in B.");} publicstaticvoid Main( ){ Trace.Msg("Now in Main.");A( ); Console.WriteLine("Done.");} }
|
I am not using C# Express but using VS 2005 Beta 2 and the example works fine, When I change the build mode from debug to release the Trace messages are no longer displayed.
Try to perform a rebuild after you switch modes to ensure that the debug files are deleted.
It's worse than i thought. It seems to me the IDE is broken.
In beta 1, there was a way to set the properties of the Build process to be "Debug". I cannot find any way to specify that the target build is Debug in Beta 2.
i assume that when i change code in the editor window, that the IDE will recognize that fact, but it ignores it. In order to get a new build, I have to delete the old files using Windows explorer. Am I making changes too fast?
BTW, how does success with VS 2005 apply to the Express product?
After uninstalling everything, and reinstalling vcsexpress only, I discover that introducing
[Conditional("ZOT")]
on a method breaks the IDE || changes the language such that the Debug version is no longer updated.
It matters not if
#define ZOT
is in the source file or not.
After a fresh start-up, and an attempt to demonstrate the problem with a Hello World program, i find that [Conditional()] works,
as expected.Conclusions:
1. My machine was somehow unstable.
2. *I* am somehow unstable.
