指定 Visual Basic 编译器应报告内部编译器错误的方式。Specifies how the Visual Basic compiler should report internal compiler errors.


-errorreport:{ prompt | queue | send | none }


此选项为将 Visual Basic 内部编译器错误 (ICE) 报告给 Microsoft 的 Visual Basic 团队提供快捷方式。This option provides a convenient way to report a Visual Basic internal compiler error (ICE) to the Visual Basic team at Microsoft. 默认情况下,编译器不向 Microsoft 发送任何信息。By default, the compiler sends no information to Microsoft. 不过,如果你遇到了内部编译器错误,则可以通过此选项将错误报告给 Microsoft。However, if you do encounter an internal compiler error, this option allows you to report the error to Microsoft. 该信息将帮助 Microsoft 工程师确认原因,并可能会帮助改进 Visual Basic 的下一个版本。That information will help Microsoft engineers identify the cause and may help improve the next release of Visual Basic.

用户能否发送报告取决于计算机和用户策略权限。A user's ability to send reports depends on machine and user policy permissions.

下表概括了 -errorreport 选项的效果。The following table summarizes the effect of the -errorreport option.

选项Option 行为Behavior
prompt 如果出现了内部编译器错误,会出现一个对话框,以便于你查看编译器收集到的准确数据。If an internal compiler error occurs, a dialog box comes up so that you can view the exact data that the compiler collected. 你可以确定错误报告中是否有任何敏感信息,并决定是否将它发送给 Microsoft。You can determine if there is any sensitive information in the error report and make a decision on whether to send it to Microsoft. 若你决定发送它,并且计算机和用户策略设置允许此操作,编译器会将数据发送给 Microsoft。If you decide to send it, and the machine and user policy settings allow it, the compiler sends the data to Microsoft.
queue 将错误报告排入队列。Queues the error report. 使用管理员权限登录时,你可以报告自上次登录后出现的任何故障(每三天内提示你发送故障报告的次数不会超过一次)。When you log in with administrator privileges, you can report any failures since the last time you were logged in (you will not be prompted to send reports for failures more than once every three days). 未指定 -errorreport 选项时,这是默认行为。This is the default behavior when the -errorreport option is not specified.
send 若出现内部编译器错误,并且计算机和用户策略设置允许此操作,编译器会将数据发送给 Microsoft。If an internal compiler error occurs, and the machine and user policy settings allow it, the compiler sends the data to Microsoft.

Windows 错误报告系统设置启用了报告,选项 -errorreport:send 会尝试自动将错误信息发送给 Microsoft。The option -errorreport:send attempts to automatically send error information to Microsoft if reporting is enabled by the Windows Error Reporting system settings.
none 若出现内部编译器错误,不会收集它,也不会将其发送给 Microsoft。If an internal compiler error occurs, it will not be collected or sent to Microsoft.

出现错误时,编译器会发送数据,其中包括通常会包含部分源代码的堆栈。The compiler sends data that includes the stack at the time of the error, which usually includes some source code. 若将 -errorreport-bugreport 选项配合使用,将发送完整的源文件。If -errorreport is used with the -bugreport option, then the entire source file is sent.

此选项最适合与 -bugreport 选项配合使用,因为这样 Microsoft 工程师即可以轻松地重现错误。This option is best used with the -bugreport option, because it allows Microsoft engineers to more easily reproduce the error.


-errorreport 选项在 Visual Studio 开发环境内无法使用;仅当从命令行编译时才可用。The -errorreport option is not available from within the Visual Studio development environment; it is available only when compiling from the command line.


下面的代码尝试编译 T2.vb,若编译器遇到内部编译器错误,它会提示你向 Microsoft 发送错误报告。The following code attempts to compile T2.vb, and if the compiler encounters an internal compiler error, it prompts you to send the error report to Microsoft.

vbc -errorreport:prompt t2.vb

请参阅See also