C# 运行EConnect示例控制台应用程序时EntryPointNotFoundException
我正在尝试运行EconConnect示例控制台应用程序,但它在mscorlib.dll中不断出现System.EntryPointNotFoundException。我一辈子都搞不懂它为什么这么做,尤其是因为我过去成功运行过这个应用程序,现在突然它不工作了 有什么想法可能导致这个问题,或者至少有一些想法我可以得到更多关于这个问题的信息。我不知道如何捕捉异常并显示更多信息,因为异常似乎在没有进入catch块的情况下出现 这是我试图运行的应用程序的代码,我尝试过跟踪它,似乎在这一行出现了异常: e、 CreateEntity(sConnectionString、sCustomerDocument) 我也多次重新安装了EconConnect,就像我之前说的,直到今天,这一切都运行得很好,所以我不知道发生了什么。在此方面的任何帮助都将不胜感激C# 运行EConnect示例控制台应用程序时EntryPointNotFoundException,c#,exception-handling,econnect,entrypointnotfoundexcept,C#,Exception Handling,Econnect,Entrypointnotfoundexcept,我正在尝试运行EconConnect示例控制台应用程序,但它在mscorlib.dll中不断出现System.EntryPointNotFoundException。我一辈子都搞不懂它为什么这么做,尤其是因为我过去成功运行过这个应用程序,现在突然它不工作了 有什么想法可能导致这个问题,或者至少有一些想法我可以得到更多关于这个问题的信息。我不知道如何捕捉异常并显示更多信息,因为异常似乎在没有进入catch块的情况下出现 这是我试图运行的应用程序的代码,我尝试过跟踪它,似乎在这一行出现了异常: e、
编辑:嗯,我发现了我的问题,结果是我关闭了Just my Code debugging(仅我的代码调试)选项,将其重新打开,然后它再次工作全部修复,我关闭了Just my Code debugging(仅我的代码调试)选项,将其重新打开,修复了问题。对于其他有相同问题的人,我所做的只是转到工具>选项>调试>常规>选中仅启用我的代码
using System;
using System.IO;
using System.Xml;
using System.Text;
using System.Xml.Serialization;
using Microsoft.Dynamics.GP.eConnect;
using Microsoft.Dynamics.GP.eConnect.Serialization;
namespace eConnect_CSharp_ConsoleApplication
{
class Test
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
string sCustomerDocument;
string sXsdSchema;
string sConnectionString;
using (eConnectMethods e = new eConnectMethods())
{
try
{
// Create the customer data file
SerializeCustomerObject("Customer.xml");
// Use an XML document to create a string representation of the customer
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load("Customer.xml");
sCustomerDocument = xmldoc.OuterXml;
// Specify the Microsoft Dynamics GP server and database in the connection string
sConnectionString = @"data source=localhost;initial catalog=TWO;integrated security=SSPI;persist security info=False;packet size=4096";
// Create an XML Document object for the schema
XmlDocument XsdDoc = new XmlDocument();
// Create a string representing the eConnect schema
sXsdSchema = XsdDoc.OuterXml;
// Pass in xsdSchema to validate against.
e.CreateEntity(sConnectionString, sCustomerDocument);
}
// The eConnectException class will catch eConnect business logic errors.
// display the error message on the console
catch (eConnectException exc)
{
Console.Write(exc.ToString());
}
// Catch any system error that might occurr.
// display the error message on the console
catch (System.Exception ex)
{
Console.Write(ex.ToString());
}
finally
{
// Call the Dispose method to release the resources
// of the eConnectMethds object
e.Dispose();
}
} // end of using statement
}
public static void SerializeCustomerObject( string filename )
{
try
{
// Instantiate an eConnectType schema object
eConnectType eConnect = new eConnectType();
// Instantiate a RMCustomerMasterType schema object
RMCustomerMasterType customertype = new RMCustomerMasterType();
// Instantiate a taUpdateCreateCustomerRcd XML node object
taUpdateCreateCustomerRcd customer = new taUpdateCreateCustomerRcd();
// Create an XML serializer object
XmlSerializer serializer = new XmlSerializer(eConnect.GetType());
// Populate elements of the taUpdateCreateCustomerRcd XML node object
customer.CUSTNMBR = "Customer001";
customer.CUSTNAME = "Customer 1";
customer.ADDRESS1 = "2002 60th St SW";
customer.ADRSCODE = "Primary";
customer.CITY = "NewCity";
customer.ZIPCODE = "52302";
// Populate the RMCustomerMasterType schema with the taUpdateCreateCustomerRcd XML node
customertype.taUpdateCreateCustomerRcd = customer;
RMCustomerMasterType [] mySMCustomerMaster = {customertype};
// Populate the eConnectType object with the RMCustomerMasterType schema object
eConnect.RMCustomerMasterType = mySMCustomerMaster;
// Create objects to create file and write the customer XML to the file
FileStream fs = new FileStream(filename, FileMode.Create);
XmlTextWriter writer = new XmlTextWriter(fs, new UTF8Encoding());
// Serialize the eConnectType object to a file using the XmlTextWriter.
serializer.Serialize(writer, eConnect);
writer.Close();
}
// catch any errors that occur and display them to the console
catch (System.Exception ex)
{
Console.Write(ex.ToString());
}
}
}
}
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Symbols loaded.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\14.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll'. Symbols loaded.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'. Symbols loaded.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Symbols loaded.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'. Symbols loaded.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\14.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll'. Symbols loaded.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\14.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll'.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Program Files (x86)\Microsoft Dynamics\eConnect 12.0\eConnect Samples\CSHARP Console Application\bin\Debug\eConnect_CSharp_ConsoleApplication.vshost.exe'. Symbols loaded.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\assembly\GAC_64\Microsoft.Dynamics.GP.eConnect\12.0.0.0__31bf3856ad364e35\Microsoft.Dynamics.GP.eConnect.dll'. Cannot find or open the PDB file.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\assembly\GAC_64\Microsoft.Dynamics.GP.eConnect.Serialization\12.0.0.0__31bf3856ad364e35\Microsoft.Dynamics.GP.eConnect.Serialization.dll'. Cannot find or open the PDB file.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll'. Symbols loaded.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Symbols loaded.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll'. Symbols loaded.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Symbols loaded.
The thread 0x2af0 has exited with code 0 (0x0).
The thread 0x2af4 has exited with code 0 (0x0).
The thread 0x2ae4 has exited with code 0 (0x0).
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Program Files (x86)\Microsoft Dynamics\eConnect 12.0\eConnect Samples\CSHARP Console Application\bin\Debug\eConnect_CSharp_ConsoleApplication.exe'. Symbols loaded.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Symbols loaded.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\System.Transactions\v4.0_4.0.0.0__b77a5c561934e089\System.Transactions.dll'. Symbols loaded.
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'Microsoft.GeneratedCode'.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll'. Symbols loaded.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll'. Symbols loaded.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\SMDiagnostics\v4.0_4.0.0.0__b77a5c561934e089\SMDiagnostics.dll'. Symbols loaded.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll'. Symbols loaded.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Internals\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Internals.dll'. Symbols loaded.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.IdentityModel\v4.0_4.0.0.0__b77a5c561934e089\System.IdentityModel.dll'. Symbols loaded.
'eConnect_CSharp_ConsoleApplication.vshost.exe' (CLR v4.0.30319: eConnect_CSharp_ConsoleApplication.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.Diagnostics.ServiceModelSink\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Diagnostics.ServiceModelSink.dll'. Symbols loaded.
Exception thrown: 'System.EntryPointNotFoundException' in mscorlib.dll
The thread 0x2a40 has exited with code 0 (0x0).
The thread 0x2a58 has exited with code 0 (0x0).
The program '[10848] eConnect_CSharp_ConsoleApplication.vshost.exe' has exited with code 0 (0x0).