c# - How to overcome the exception "The Type Initializer for "SAP.Middleware.Connector.RfcConfigParameters" threw an exception - Error#:-2146233036" -


we have applications fetching data sap systems through dcom sap connector. have replaced .net connector. after deploying production worked 1 day. giving specified error while accessing 1 rfc. exception message is

the type initializer "sap.middleware.connector.rfcconfigparameters" threw exception - error#:-2146233036.

the code use create object sap.middleware.connector.rfcconfigparameters , use below

string value1 ="val1"; string value1 ="val2"; string value1 ="val3"; string value1 ="val4"; string value1 ="val5"; string value1 ="val6"; string value1 ="val7";  rfcconfigparameters parms = new rfcconfigparameters();  parms.add(rfcconfigparameters.param1, value1); parms.add(rfcconfigparameters.param2, value2); parms.add(rfcconfigparameters.param3, value3); parms.add(rfcconfigparameters.param4, value4); parms.add(rfcconfigparameters.param5, value5); parms.add(rfcconfigparameters.param6, value6); parms.add(rfcconfigparameters.param7, value7);  saprfcdestination = rfcdestinationmanager.getdestination(parms); rfccustomdestination customdest = saprfcdestination.createcustomdestination(); irfcfunction func = customdest.repository.createfunction("rfc_function");  func.setvalue("data1", "val1") func.setvalue("data2", "val2") func.setvalue("data3", "val3")  rfcstructuremetadata metadata = customdest.repository.getstructuremetadata("structurename"); irfctable rfctable = func.gettable("tablename"); 

we have traced exception information , below exception information

system.typeinitializationexception: type initializer '<module>' threw exception. ---> <crtimplementationdetails>.moduleloadexception: c++ module failed load.  ---> system.io.fileloadexception: not load file or assembly 'msvcm80, version=8.0.50727.6195, culture=neutral, publickeytoken=b03f5f7f11d50a3a' or 1 of dependencies. catastrophic failure (exception hresult: 0x8000ffff (e_unexpected)) file name: 'msvcm80, version=8.0.50727.6195, culture=neutral, publickeytoken=b03f5f7f11d50a3a' ---> system.runtime.interopservices.comexception (0x8000ffff): catastrophic failure (exception hresult: 0x8000ffff (e_unexpected))    @ <crtimplementationdetails>.dodlllanguagesupportvalidation()    @ <crtimplementationdetails>.languagesupport._initialize(languagesupport* )    @ <crtimplementationdetails>.languagesupport.initialize(languagesupport* )      --- end of inner exception stack trace ---    @ <crtimplementationdetails>.throwmoduleloadexception(string errormessage, exception innerexception)    @ <crtimplementationdetails>.throwmoduleloadexception(string , exception )    @ <crtimplementationdetails>.languagesupport.initialize(languagesupport* )    @ .cctor()    --- end of inner exception stack trace ---    @ sap.middleware.connector.rfcconfigparameters..cctor()- stack trace:   @ sap.middleware.connector.rfcconfigparameters..ctor() 

below our observations
1. not throwing issue always. issue throwing intermittently.
2. when go server machine , run application there, not throwing error. error throwing if application access other client machnies.
3. same issue not reproducible in dev, test , stage environments. issue in production alone 4. if redeploy specific dll start work without error 1 day or half day , next day onwards throw error.

my specific questions (1) how overcome exception says "the type initializer "sap.middleware.connector.rfcconfigparameters" threw exception - error#:-2146233036"?
(2) our primary suspect area memory leaks. can suspect other areas?
(3) have limited no access production environment. trying reproduce issue in other servers in have full access dev , test. considering multi user , multi login scenarios in order reproduce issue in other environments. can consider other scenarios?

update
managed reproduced issue in 1 of our test servers. , tried below things resolve issue. , installed visual c++ 2005 redistributable sp1, .net connector 3.0 , vb6.0. still issue there. unable found root cause issue.

what else can check , in order found root cause issue?

edits based on response:
1. not using static variables 2. have installed visual c++ 2005 redistributable sp1.but still didn't resolve issue.

this thread suggests installing visual c++ 2005 redistributable sp1 package resolved it. (due dependency in sapnco_utils.dll)


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -