问题描述
我正在制作一个使用 Rfc Connector 的方法。它工作正常,但出了点问题,现在我遇到了这两个问题。
-
有时(这不是规则)我从
OutOfMemoryException
得到Session = new NWRfcSession();
。我认为没有任何理由(没有大数据)。
有人可以帮我吗?我使用的是 VS 16.8.3 和 .NET 5.0。非常感谢!
public class RFCMethodsForSLS
{
private NWRfcSession Session;
//Info: https://rfcconnector.com/documentation/api/session/
public bool WasConnected { get; private set; }
public bool ResultWasNull { get; private set; }
private DataContext dataContext;
private List<Regex> listOfRegexFromDatabase;
public Exception Exception { get; private set; }
/// <summary>
/// Calls the "Connecting" method which returns wanted project entries from SAP
/// </summary>
/// <param name="inputString">String which will be searched</param>
/// <param name="onlyIn4711">True for entries active in only in OEZ</param>
/// <param name="onlyActive">True for active entries</param>
/// <param name="maxRows">Set maximum returned rows count</param>
public RFCMethodsForSLS()
{
try
{
Session = new NWRfcSession();
}
catch (Exception e) when (e is System.OutOfMemoryException) //when the connection is not possible
{
Exception = e; //if the connection is impossible then set Exception property
}
if (Exception is null)
{
dataContext = new DataContext();
listOfRegexFromDatabase = new List<Regex>();
foreach (MLFBCodeGroups mLFBCodeGroups in dataContext.MLFBCodesGroups.ToList())
listOfRegexFromDatabase.Add(new Regex(mLFBCodeGroups.Regex));
}
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)