1

I am making a method which uses Rfc Connector. It was working fine, but something went wrong and now I have those two issues.

  1. Sometimes(it is not a rule) I get the OutOfMemoryException from Session = new NWRfcSession();. I think there is no reason for this (no big data).

  2. 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));
        }
    }
    
}
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Mazounn
  • 27
  • 4
  • Have you done any memory profiling to see if there is anything suspicious? Are you running in x86? A possible reason might just be a bug in the library, if so it would be better to report it to the authors of the library. – JonasH Mar 03 '21 at 10:29
  • Unfortunately, I am the amateur in programming so I do not know how to do a memory profiling. Could you recommend some tool? I have Win 10 x64. – Mazounn Mar 03 '21 at 12:14
  • Even if you have x64 windows, the program might still run in 32 bits. You can check in the task manager if the program is listed like "xyz (32 bit)". I have used dotMemory and Ants, they are a bit expensive, but are easy to use. There are also some free tools. – JonasH Mar 03 '21 at 12:19
  • OK, you are right. My Visual Studio works on 32bit but as I jsut found out the VS is not made in x64 version. So is there any idea how to fix it? Or should I ask the authors of the library? Thank you!! – Mazounn Mar 03 '21 at 12:35
  • It is not Visual studio that is crashing. It is your program. There is no issue developing and debugging 64 bit programs with 32 bit visual studio. – JonasH Mar 03 '21 at 12:59
  • The program you mean my code? So is there a way how to fix the bug? – Mazounn Mar 03 '21 at 13:44
  • This is no library from SAP. So calling it "SAP RFC connector" is confusing. – Trixx Mar 03 '21 at 14:22
  • OK, it is not a library. I am sorry, I am not a specialist. – Mazounn Mar 03 '21 at 19:27
  • I have edited the question to mention "[Rfc Connector](https://rfcconnector.com/)" that is according to the authors "a library which enables your applications to send and receive SAP RFC function calls and extract data from SAP tables." Maybe contact the vendor to have adequate support, or re-write your program to use directly the official RFC library published by SAP (SAP .NET Connector). – Sandra Rossi Mar 04 '21 at 09:16
  • We are not able to use SAP in the other way. In our company the RFC connector is basically installed on our computers so all ITs use it (for much smaller issues). OK, the only way is to contact the SAP helpdesk. Thank you :-) – Mazounn Mar 04 '21 at 10:14

0 Answers0