1
当创建新的类实例时,我得到“在System.Deployment.dll中发生类型'System.Deployment.Application.InvalidDeploymentException'的第一次机会异常”。无效的部署异常
它发生在:
PrinterSettings^ MyPS = gcnew PrinterSettings();
一切正常,我也得到一个值,我想要的。
Form1.cpp:
#include "stdafx.h"
#include "Form1.h"
#include "Print.h"
#include <iostream>
System::Void DPrint::Form1::Form1_Load(System::Object^ sender, System::EventArgs^ e)
{
PrinterSettings^ MyPS = gcnew PrinterSettings();
System::Windows::Forms::MessageBox::Show("From Class PrinterSettings: " + MyPS->IniFilePath());
}
Print.h:
#ifndef PRINT_H
#define PRINT_H
public ref class PrinterSettings
{
private:
System::String^ m_strPath;
public:
PrinterSettings()
{
m_strPath = System::Windows::Forms::Application::UserAppDataPath;
}
System::String^ IniFilePath() { return m_strPath; };
};
#endif
任何想法是怎么回事?谢谢。
因此,我试图获得一个将在未来(部署后)才知道的值?这是否意味着我与它无关?谢谢。 编辑:我知道这只是一个调试问题。 – Nikonation
@Nikonation如果只是第一次机会例外,用户将永远不会看到它。假设没有其他问题,你应该没问题。 – akton
非常感谢! – Nikonation