I am trying to catch an Exception and pass those values to another method but I am getting Argument '1' must be passed with 'ref' keyword, A ref or out argument must be an assignable variable and the best overloaded method match for abc.AbendProgram(ref string, ref System.Exception) has some invalid arguments. please help as I am not sure what mistake I am making.
private void OpenDatabases()
{
try
{
WinDSSS.connectionString =
ConfigurationManager.AppSettings["WinDSS_Connection"].Replace("%DrivePath%", DrivePath);
}
catch (Exception ex)
{
logger.AddEntry(TFSUtilities.Logger.EventType.Fatal,
"frmMain.OpenDatabases", "Exception", ref ex);
AbendProgram(ref "Open Database", ref ex);
}
}
private void AbendProgram(ref string theRoutine, ref Exception theException)
{
int errorNumber = -1;
string ErrorDesc = "Unknown Error";
if ((theException != null))
{
errorNumber = 9999;
ErrorDesc = theException.ToString();
if ((theException.InnerException != null))
{
ErrorDesc = ErrorDesc + Constants.vbCrLf +
theException.InnerException.Message;
}
}
System.Windows.Forms.MessageBox.Show("There was an error in RSCShell:" +
theRoutine + Constants.vbLf + Constants.vbLf + Constants.vbLf +
"Error " + errorNumber + " - " + ErrorDesc +
Constants.vbLf + Constants.vbLf + "Please contact SUPPORT to resolve this issue");
System.Environment.Exit(0);
}