0

我有一个夜间构建 DOS 批处理脚本,它调用 devenv.exe 来构建解决方案文件。我间歇性地观察到 devenv.com 崩溃。我得到一个 DW20.exe“分享你的痛苦”对话框。

1)如果按下调试按钮,我不会看到通常的“选择您的调试器”窗口。相反,它什么也不做。

2) 如果我启动 Visual Studio 并尝试附加到 devenv.com,它说应用程序似乎已死锁或等待操作完成。(我认为是因为它是由 DW20.exe 调试的)

你会建议我做什么来获得一个体面的调用堆栈?

编辑

我成功地让 WinDBG 附加。执行了 k 命令。以下看起来是否有意义,可以传递给编译器团队?有没有办法查看当前的异常?

(e90.fb8): Break instruction exception - code 80000003 (!!! second chance !!!)
eax=0012ccb8 ebx=04ed2750 ecx=0111bdc4 edx=5a57f004 esi=00000000 edi=14ed1000
eip=77e4bef7 esp=0012ccb4 ebp=0012cd08 iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000246
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\WINDOWS\system32\kernel32.dll - 
kernel32!RaiseException+0x3c:
77e4bef7 5e              pop     esi
Missing image name, possible paged-out or corrupt data.
Missing image name, possible paged-out or corrupt data.
Missing image name, possible paged-out or corrupt data.
Missing image name, possible paged-out or corrupt data.
0:000> k
ChildEBP RetAddr  
WARNING: Stack unwind information not available. Following frames may be wrong.
0012cd08 5a760cf1 kernel32!RaiseException+0x3c
0012cd58 5a766105 cslangsvc!InMemoryCompile+0x4c6c1
0012cd7c 5a767375 cslangsvc!InMemoryCompile+0x51ad5
0012cd84 5a767637 cslangsvc!InMemoryCompile+0x52d45
00000000 00000000 cslangsvc!InMemoryCompile+0x53007

我正在努力!analyze -v工作。

0:000> !analyze -v
*******************************************************************************
*                                                                             *
*                        Exception Analysis                                   *
*                                                                             *
*******************************************************************************

***** OS symbols are WRONG. Please fix symbols to do analysis.

*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: ntdll!_PEB                                    ***
***                                                                   ***
*************************************************************************
c0000005 Exception in ext.analyze debugger extension.
PC: 014d7875  VA: 00000000  R/W: 0  Parameter: 0001003f

编辑 2

我发现 WinDBG 有这些很棒的 SOS 扩展。显然我可以使用它们来调试 C# 编译器...

0:000> !PrintException
There is no current managed exception on this thread
0:000> !clrstack
OS Thread Id: 0x9fc (0)
ESP       EIP     
0012ee08 77e4bef7 [ComPlusMethodFrameGeneric: 0012ee08] Microsoft.Build.Tasks.Hosting.ICscHostObject.Compile()
0012ee18 6be671ab Microsoft.Build.Tasks.Csc.CallHostObjectToExecute()
0012ee48 6c0aed17 Microsoft.Build.Utilities.ToolTask.Execute()
0012ee7c 6bcbb348 Microsoft.Build.BuildEngine.TaskEngine.ExecuteTask(ExecutionMode, System.Collections.Hashtable, Microsoft.Build.BuildEngine.BuildPropertyGroup, Boolean ByRef)
0012ef24 6bcadf87 Microsoft.Build.BuildEngine.Target.ExecuteAllTasks(Microsoft.Build.BuildEngine.DependencyAnalysisResult, System.Collections.Hashtable, System.Collections.Hashtable, Microsoft.Build.BuildEngine.ItemBucket, System.Collections.ArrayList, Microsoft.Build.BuildEngine.BuildPropertyGroup)
0012efa0 6bcac7c0 Microsoft.Build.BuildEngine.Target.ExecuteAllTasks()
0012efec 6bcad05b Microsoft.Build.BuildEngine.Target.Build(System.Collections.IDictionary)
0012f070 6bcacfa6 Microsoft.Build.BuildEngine.Target.Build(System.Collections.IDictionary)
0012f0f4 6bcacfa6 Microsoft.Build.BuildEngine.Target.Build(System.Collections.IDictionary)
0012f178 6bcacfa6 Microsoft.Build.BuildEngine.Target.Build(System.Collections.IDictionary)
0012f1fc 6bc9b20d Microsoft.Build.BuildEngine.Project.DoBuild(System.String[], System.Collections.IDictionary, Boolean)
0012f250 6bca2134 Microsoft.Build.BuildEngine.Engine.BuildProject(Microsoft.Build.BuildEngine.Project, System.String[], System.Collections.IDictionary, Microsoft.Build.BuildEngine.BuildSettings, Boolean)
0012f2ac 6bc9af03 Microsoft.Build.BuildEngine.Project.Build(System.String[], System.Collections.IDictionary)
0012f2c0 04711a36 Microsoft.VisualStudio.Build.ComInteropWrapper.ProjectShim.BuildTarget(System.String, System.Collections.IDictionary)
0012f4f4 79f68cde [GCFrame: 0012f4f4] 
0012f650 79f68cde [ComMethodFrame: 0012f650] 

我仍在寻找一种检查异常内容的方法。!PrintException 没有发现任何异常。

4

3 回答 3

1

您可以尝试安装Windows 调试工具,然后使用-iae选项(用于 NTSD/CDB)或-I选项(用于 WinDBG)使该软件包中的调试器之一成为 JIT/AeDebug 调试器。

于 2009-05-07T15:21:30.143 回答
0

我终于找到了错误编译器的异常类型和调用堆栈。为此,我保存了一个完整的转储文件 (.dump /ma c:\myCSCdump.dmp),然后像在 VS2005 中打开任何其他项目文件一样打开转储文件。按下运行按钮在调用堆栈窗口中产生以下内容:

kernel32.dll!_RaiseException@16()  + 0x3c bytes 

cslangsvc.dll!ALLOCHOST::ThrowOutOfMemoryException() + 0x10 字节
cslangsvc.dll!PAGEHEAP::AllocPages() + 0xc1fd8 字节
cslangsvc.dll!SYMTBL::GrowTable() + 0x5b 字节 cslangsvc.dll!BSYMMGR::AddChild() + 0x3b 字节 cslangsvc.dll!BSYMMGR::CreateGlobalSym() + 0x2ba 字节 cslangsvc.dll!BSYMMGR::CreateMethod() + 0xc 字节
cslangsvc.dll!IMPORTER::ImportMethod() + 0x1d9 字节
cslangsvc.dll!IMPORTER::DefineImportedType( ) + 0x3b2 字节 cslangsvc.dll!CLSDREC::prepareAggregate() + 0x8d 字节 cslangsvc.dll!COMPILER::ForceAggStates() + 0x8e 字节
cslangsvc.dll!COMPILER::ForceAggStates() + 0x127 字节 cslangsvc.dll!COMPILER::EnsureState() + 0x2e 字节 cslangsvc.dll!CLSDREC::CheckForTypeErrors() + 0x23 字节
cslangsvc.dll!CLSDREC::CheckForTypeErrors() + 0x2ba 字节
cslangsvc.dll!CLSDREC::CheckForTypeErrors() + 0x80 字节
cslangsvc.dll!CLSDREC::CheckForTypeErrors() + 0x8a 字节
cslangsvc.dll!CLSDREC::CheckForTypeErrors() + 0x8a 字节
cslangsvc.dll!CLSDREC::CheckForTypeErrors( ) + 0x8a 字节
cslangsvc.dll!COMPILER::CheckForTypeErrors() + 0x100 字节 cslangsvc.dll!COMPILER::CompileAll() + 0x546 字节 cslangsvc.dll!COMPILER::Compile() + 0x7c 字节 cslangsvc.dll!CController::RunCompiler() + 0x177 字节 cslangsvc.dll!CController::Compile() + 0x16 字节
cslangsvc.dll!CCSharpProjectSite::BuildProjectCore() + 0x5a 字节
cslangsvc.dll!CProjectSite::BuildProject() + 0x11 字节
csproj.dll!CCSharpBuildCompiler::DoMainBuild( ) + 0x88 字节
csproj.dll!CCscMSBuildHostObject::Compile() + 0x4e 字节
mscorwks.dll!_CLRToCOMWorker@8() + 0x171 字节

于 2009-05-07T20:20:20.567 回答
0

这有点罗嗦,所以我会发布它作为回复。它取自 Microsoft Connect 站点,以回应我的问题。读者可能会发现它相关:

日期:2009 年 5 月 7 日星期四 19:14:52 -0700

来自 Microsoft Connect 的问候!

此通知是针对您在 Microsoft Connect 站点提交的反馈项生成的:夜间构建问题(存储桶 365749762)。

感谢您报告您在使用 Visual Studio 2005 时遇到的这个问题,并感谢您提供的转储!

看起来问题出在 cslangsvc.dll(进程内 C# 编译器)中,DevEnv 正在调用它来执行您的构建。

我们解决此问题的建议是尝试使用 MSBuild 来进行夜间构建,因为这应该比自动化 DevEnv /build 更强大。具体来说,您可能会避免此特定问题,因为 MSBuild 将使用 csc.exe 而不是 cslangsvc.dll 进行编译。

我们不太可能有进一步的 VS 2005 版本来修复 cslangsvc 问题,所以我正在解决这个错误不会修复,但如果您在使用 MSBuild 时仍然看到问题,请重新激活它。

再次感谢您提供有关此问题的所有信息!

Alex Turner 项目经理 Visual C# 编译器

于 2009-05-08T02:55:28.447 回答