I am making a method which uses Rfc Connector. It was working fine, but something went wrong and now I have those two issues.
Sometimes(it is not a rule) I get the
OutOfMemoryException
fromSession = new NWRfcSession();
. I think there is no reason for this (no big data).My colleague has other trouble with the same command: his procedure usually stacked here, the processor is working but nothing else happened.
Can anyone help me please? I am using VS 16.8.3 and .NET 5.0. Thank you a lot!
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));
}
}
}