Obfuscation 使用SmartAssembly自动记录错误并终止应用程序
我在应用程序中使用通用代码混淆和错误报告 如果我的应用程序遇到未处理的异常,我希望记录该异常,然后在没有任何用户交互的情况下终止应用程序。是否可以创建允许此操作的SmartAssembly项目 我已经尝试在SmartAssembly GUI中设置该项目,但没有成功。下面是我尝试过的命令和参数,但到目前为止,我无法确定如何让它在没有用户输入的情况下终止应用程序并记录错误 创建SA项目:Obfuscation 使用SmartAssembly自动记录错误并终止应用程序,obfuscation,error-reporting,redgate,smartassembly,Obfuscation,Error Reporting,Redgate,Smartassembly,我在应用程序中使用通用代码混淆和错误报告 如果我的应用程序遇到未处理的异常,我希望记录该异常,然后在没有任何用户交互的情况下终止应用程序。是否可以创建允许此操作的SmartAssembly项目 我已经尝试在SmartAssembly GUI中设置该项目,但没有成功。下面是我尝试过的命令和参数,但到目前为止,我无法确定如何让它在没有用户输入的情况下终止应用程序并记录错误 创建SA项目: "C:\Program Files\Red Gate\SmartAssembly 6\SmartAssembly
"C:\Program Files\Red Gate\SmartAssembly 6\SmartAssembly.com"
/create shell.saproj input=C:\Repositories\MyApp\src\shell.exe
/output=shell.exe
/reportappname="MyTestApp"
/errorreportingtemplate=standard;continueonerror=false,email:"my@email.com"
/reportprojectname="Shell"
/reportcompanyname="My Company"
"C:\Program Files\Red Gate\SmartAssembly 6\SmartAssembly.com" /build shell.saproj
构建项目:
"C:\Program Files\Red Gate\SmartAssembly 6\SmartAssembly.com"
/create shell.saproj input=C:\Repositories\MyApp\src\shell.exe
/output=shell.exe
/reportappname="MyTestApp"
/errorreportingtemplate=standard;continueonerror=false,email:"my@email.com"
/reportprojectname="Shell"
/reportcompanyname="My Company"
"C:\Program Files\Red Gate\SmartAssembly 6\SmartAssembly.com" /build shell.saproj
根据网站上的例子
您应该将“标准”替换为“自动”,这样可以在不显示用户对话框的情况下发送错误报告。SmartAssembly包括一些自定义错误报告模板的示例,
位于红门/SmartAssembly 6/SDK/Exception Reporting/ 这些例子被归为几个类别:
没有用户界面
标准
自定义用户界面
通过电子邮件
安全代理
Silverlight
Silverlight Basic
在每个文件夹中,都有一个.csproj文件,可以扩展该文件以获得所需的结果。
在无UI
文件夹中是我们正在关注的项目,标题为示例01-无用户界面。csproj
如果您只是想使用.dll
而不关心可重用的解决方案,请直接编辑此文件并使用生成的.dll
文件(另一种方法是创建新项目,并引入对SmartAssembly.SmartExceptionsCore
的引用)
编辑OnReportException
函数,如下所示:
protected override void OnReportException(ReportExceptionEventArgs e)
{
for (int i=0; i<3; i++)
{
if (e.SendReport()) break;
}
e.TryToContinue = false;
System.Diagnostics.Process proc = System.Diagnostics.Process.GetCurrentProcess();
proc.Kill();
}
使用GUI或通过cmd生成:
"C:\Program Files\Red Gate\SmartAssembly 6\SmartAssembly.com"
/create shell.saproj input=C:\Repositories\MyApp\src\shell.exe
/output=shell.exe
/reportappname="MyTestApp"
/errorreportingtemplate=MySmartAssemblyLogger.dll;continueonerror=false,email:"my@email.com"
/reportprojectname="Shell"
/reportcompanyname="My Company"
"C:\Program Files\Red Gate\SmartAssembly 6\SmartAssembly.com" /build shell.saproj
使用
auto
自动记录错误,但是我找不到正确的设置来在没有用户交互的情况下额外终止应用程序。