Administrator

Administrator

  • Tech Writer
  • 2.2k
  • 1.5m

Release Vs Debug build differences

Apr 8 2003 7:19 AM
All, I've been banging my head against a brick wall with a very strange problem, and although I now know the cause, I can't find a solution. Basically, array initialization appears to be different in Release builds than it is for Debug builds, although I had assumed that in .NET there shouldn't be those sorts of issues. private static byte[] RemovePadding( byte[] aData, long lLength ) { byte[] aRetVal = new byte[lLength]; for ( long l = 0; l < lLength; l++ ) { aRetVal[l] = aData[l]; } return aRetVal; } This method is used in conjunction with some legacy encryption and compression components that have been coded in C. The main problems are: in release, this returns a byte array that is one character short, if the original string that has been converted to a byte array using ASCIIEncoding (or UTF8Encodinf) contained the ' character, the code is built as Release, and there is no tracing. If I put some simple tracing in the code, it works fine...which makes debugging very difficult. Has anyone come across these issues when comparing Debug and Release builds, and how did you resolve them? Thanks in advance, Liam

Answers (1)