J
Jón Óskar Erlendsson
hi there,
I got a rather annoying functionality in my code that I could not figure
out.
My system is built with a "operation based" functionality which means that
a user's permission is based on which stored procedures he/she can execute
through the program.
When I ran it in debug mode ( either F5 or CTRL+F5) the code worked fine,
but when it came to running it in release mode an unexptected behavior was
presented.
let me show you the code:
public void DeleteFFN( int contactId, int airlineId,
IM.Windows.Helper.User user )
{
this.sprocName = "DeleteFFN_sp";
if( user.SystemSproc.ContainsKey(this.sprocName) ) // SystemSproc is a
hashtable
{
try
{
int numRows = SqlHelper.ExecuteNonQuery( this.connectionString,
this.sprocName, new Object[]{contactId, airlineId} );
}
catch( System.InvalidOperationException ex )
{
throw new
IM.Exception.IMGenericException(this.genericExceptionMessage, ex);
}
catch( System.Data.SqlClient.SqlException ex )
{
throw new
IM.Exception.IMGenericException(this.genericExceptionMessage, ex);
}
/* NOTE THIS EMPTY FINALLY BLOCK: */
finally
{
}
}
else
{
throw new
IM.Exception.ExecutePermissionDeniedException(this.executeDeniedMessage,
sprocName, user.UserName);
}
}
in release mode the exception in the else statement was thrown, but the code
in the if statement executed successfully.
when I removed the empty finally clause, the exception was not thrown.
why this occurs I do not know but I it would be greatly appreciated if
someone could explain this to me...
kind regards,
jon oskar erlendsson MCP
Information Management, Iceland
I got a rather annoying functionality in my code that I could not figure
out.
My system is built with a "operation based" functionality which means that
a user's permission is based on which stored procedures he/she can execute
through the program.
When I ran it in debug mode ( either F5 or CTRL+F5) the code worked fine,
but when it came to running it in release mode an unexptected behavior was
presented.
let me show you the code:
public void DeleteFFN( int contactId, int airlineId,
IM.Windows.Helper.User user )
{
this.sprocName = "DeleteFFN_sp";
if( user.SystemSproc.ContainsKey(this.sprocName) ) // SystemSproc is a
hashtable
{
try
{
int numRows = SqlHelper.ExecuteNonQuery( this.connectionString,
this.sprocName, new Object[]{contactId, airlineId} );
}
catch( System.InvalidOperationException ex )
{
throw new
IM.Exception.IMGenericException(this.genericExceptionMessage, ex);
}
catch( System.Data.SqlClient.SqlException ex )
{
throw new
IM.Exception.IMGenericException(this.genericExceptionMessage, ex);
}
/* NOTE THIS EMPTY FINALLY BLOCK: */
finally
{
}
}
else
{
throw new
IM.Exception.ExecutePermissionDeniedException(this.executeDeniedMessage,
sprocName, user.UserName);
}
}
in release mode the exception in the else statement was thrown, but the code
in the if statement executed successfully.
when I removed the empty finally clause, the exception was not thrown.
why this occurs I do not know but I it would be greatly appreciated if
someone could explain this to me...
kind regards,
jon oskar erlendsson MCP
Information Management, Iceland