简体   繁体   English

运行EConnect示例控制台应用程序时出现EntryPointNotFoundException

[英]EntryPointNotFoundException when running EConnect sample console app

I'm trying to run an EConnect sample console app but it keeps coming up with System.EntryPointNotFoundException in mscorlib.dll. 我正在尝试运行EConnect示例控制台应用程序,但它不断在mscorlib.dll中提出System.EntryPointNotFoundException。 I can't for the life of me figure out why its doing this, especially because I have successfully ran this app in the past and now all of a sudden it doesn't work. 我一辈子都无法弄清楚为什么要这么做,尤其是因为我过去已经成功运行了该应用程序,但突然之间它不起作用了。

Any ideas what could be causing this problem or at least some ideas how I could get more information about the problem. 任何可能导致此问题的想法,或者至少有一些想法我如何获得有关该问题的更多信息。 Im not sure how to catch the exception and display more info because the exception seems comes up without going into the catch block. 我不确定如何捕获异常并显示更多信息,因为似乎出现了异常而没有进入catch块。

Here is the code for the app Im trying to run, I've tried tracing through it and it seems like the exception is occuring around this line: e.CreateEntity(sConnectionString, sCustomerDocument); 这是我试图运行的应用程序的代码,我已经尝试了对其进行跟踪,似乎在此行附近发生了异常:e.CreateEntity(sConnectionString,sCustomerDocument);

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());
            }
        }
    }
}

Here is the output from the debug: 这是调试的输出:

'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).

I have also reinstalled eConnect numerous times, and like I said before this was all working perfectly fine until today so I dont know whats going on. 我还多次重新安装了eConnect,就像我之前说过的那样,直到今天一切都运转良好,所以我不知道发生了什么。 Any help on this would be greatly appreciated. 任何帮助,将不胜感激。

EDIT: Well, I found my issue, turns out I had the Just My Code debugging option turned off, turned that back on and it works again 编辑:好吧,我发现了我的问题,原来我关闭了Just My Code调试选项,然后重新打开它,它又能正常工作了

All fixed, I had the Just My Code debugging option turned off, turning it back on fixed the issue. 全部修复后,我关闭了“我的代码”调试选项,将其重新打开以解决此问题。 For anyone else with the same problem all I did was go to Tools>Options>Debugging>General>check Enable Just My Code 对于其他遇到相同问题的人,我所要做的就是转到“工具”>“选项”>“调试”>“常规”>选中“仅启用我的代码”

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 运行用于语音识别的控制台应用程序时的RaceOnRCWCleanup - RaceOnRCWCleanup when running console app for speech recognition 使用Mono运行控制台应用程序时出现奇怪的错误? - Weird error when running a console app with mono? 从控制台运行dotnet core应用程序时无法解决依赖关系 - Unable to resolve dependency when running dotnet core app from console 使用aff文件时System.EntryPointNotFoundException - System.EntryPointNotFoundException when using aff file 在C#中使用TaskDialog时的EntryPointNotFoundException - EntryPointNotFoundException when using TaskDialog in C# 当启动应用程序是控制台应用程序时,防止iisexpress在解决方案中运行网站 - Prevent iisexpress from running the websites in a solution when the startup app is a console app 在 .net 核心 3.0 BackgroundService 应用程序中,为什么我的配置 object 作为服务运行时为空,而不是作为控制台应用程序运行? - In a .net core 3.0 BackgroundService app, why is my configuration object empty when running as service, but not as console app? 将单个项目控制台应用程序作为可执行文件运行时找不到 App.Config - App.Config not found when running single project console app as an executable 在C#控制台应用程序中运行C ++控制台应用程序 - Running a c++ console app inside a C# console app 在C#中绑定C ++ DLL时的EntryPointNotFoundException - EntryPointNotFoundException when binding C++ dll in C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM