I use this code :
MethodInvoker TileLoadCompleteMethodInvoker = delegate()
{
CleanStatusLabelTimer.Enabled = true;
MemoryTextBox.Text = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0:0.00} MB of {1:0.00} MB", MainMapControl.Manager.MemoryCache.Size, MainMapControl.Manager.MemoryCache.Capacity);
};
try
{
BeginInvoke(TileLoadCompleteMethodInvoker);
}
catch (TargetInvocationException ex)
{
BLL.FunctionsClass.LogExceptions(ex.InnerException);
}
LogExceptions method is here :
public class LogExceptions
{
public static void WriteLogException(Exception exMsg)
{
string filePath = Application.StartupPath + "\\ExceptionLog.log";
using (System.IO.StreamWriter file = new System.IO.StreamWriter(filePath, true))
{
file.WriteLine("-------------------Exception Begin----------------------");
file.WriteLine(string.Format("Date: {0}, Time: {1}", DateTime.Now.ToShortTimeString()));
file.WriteLine(string.Format("Exception Message: {0}", exMsg.ToString()));
file.WriteLine(string.Format("Source: {0}", exMsg.Source));
file.WriteLine("-------------------Exception End----------------------");
file.WriteLine();
}
}
}
this method save exceptions in log file. but this error happend when call LogExceptions method;
Non-invocable member ‘IslamAtlas.BLL.FunctionsClass.LogExceptions’ cannot be used like a method.
how can i fix this? thanks.
You’re calling class, not method!
Use this instead:
More: you have another error here:
You call
String.Formatwith two arguments but pass only one!More and more: this line
should be in my opinion