Forum C# Whitelist System.Diagnostics?

Whitelist System.Diagnostics?

Postby dsaunder » September 22nd, 2011, 5:48 am

I was wondering if we could get System.Diagnostics whitelisted? Maybe for dev server only?

Specifically, I'm trying to make a wrapper for ErrorLog and I want to break in the debugger whenever an error occurs in debug only to be able to walk up the callstack:

void WriteError( string strError, Exception exception )
{
// Pass the error to PlayerIO
PlayerIO.ErrorLog.WriteError( strError, exception );
#if DEBUG
System.Diagnostics.Debugger.Break();
#endif
}

I don't like the fact that trying to use non-whitelisted codez is a fatal error. What would be AWESOME is if non-whitelisted code could be used WITHOUT being fatal in Debug, but be a fatal error in Release. This way I don't have pollute the forums with 1000 posts begging for different things to be whitelisted to ease development :D

Eh?

-D
dsaunder
 
Posts: 23
Joined: July 22nd, 2010, 7:28 am

Re: Whitelist System.Diagnostics?

Postby Henrik » September 24th, 2011, 11:48 am

Add <add key="DisableCodeScan" value="true" /> to the app.config of the gameserver project, and you can do whatever. :-)
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Whitelist System.Diagnostics?

Postby dsaunder » December 16th, 2011, 12:15 am

This doesn't work for me because I need a constant reminder that I can't use static data :D

Is there any way to disable exceptions printing to the console and just make them break in the debugger?
dsaunder
 
Posts: 23
Joined: July 22nd, 2010, 7:28 am

Re: Whitelist System.Diagnostics?

Postby whitershores » July 25th, 2012, 9:51 pm

Henrik wrote:Add <add key="DisableCodeScan" value="true" /> to the app.config of the gameserver project, and you can do whatever. :-)


- Can you please elaborate how I do this? There is no app.config in either of the projects.

If I choose 'Add New Item' and then 'App.Config' then paste in the above as:
Code: Select all
<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <add key="DisableCodeScan" value="true" />

</configuration>


- This will generate an error: ConfigurationErrorsException was unhandled?
{"Configuration system failed to initialize"}
whitershores
Paid Member
 
Posts: 88
Joined: June 21st, 2011, 4:19 pm

Re: Whitelist System.Diagnostics?

Postby Henrik » July 25th, 2012, 11:15 pm

Oh, sorry, you need to put it in the appSettings section of app.config for your startup project, and that entire file should look like this:
Code: Select all
<?xml version="1.0"?>
<configuration>
   <appSettings>
      <add key="DisableCodeScan" value="true" />
   </appSettings>
</configuration>
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm


Return to C#



cron