当我执行以下函数时,出现错误:
“错误‘Excel1.WebServiceFunctions.CreateMyTask()’:并非所有代码路径都返回值
我的代码:
public int CreateMyTask()
{
try
{
Console.WriteLine("Invoking CreateTask method");
Console.WriteLine("-----------------------------------");
m_taskID = taskClient.CreateTask(m_tInstance);
Console.WriteLine("Task create successfully:ID=" + m_taskID.ToString());
Console.WriteLine("-----------------------------------");
return m_taskID;
}
catch (Exception ex)
{
MessageBox.Show("An exception has occured. Please check the Excel sheet for more info" + ex);
}
finally
{
GC.Collect();
}
}
关于我如何支持这个的任何想法?我做了一些谷歌搜索,但我无法准确归零