C# 当前不会命中断点。未在 Silverlight 应用程序中为该文档加载任何符号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2301216/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 01:14:29  来源:igfitidea点击:

The breakpoint will not currently be hit. No symbols have been loaded for this document in a Silverlight application

c#asp.netwcfdebuggingiis

提问by Christian Casutt

Ok, what I have:

好的,我有什么:

Visual Studio 2010 RC, W7 x64, started a new project type of Silverlight application. Hosting the Silverlight application in a ASP.NET Web Application Project. Silverlight Version 3.0. Added a LinqToSQL Class, a WCF Service, a Winform Tester Application (Project in the Solution) and a few Classes (also as Projects in the Solution).

Visual Studio 2010 RC,W7 x64,启动了一个新的项目类型 Silverlight 应用程序。在 ASP.NET Web 应用程序项目中托管 Silverlight 应用程序。Silverlight 3.0 版。添加了一个 LinqToSQL 类、一个 WCF 服务、一个 Winform 测试应用程序(解决方案中的项目)和一些类(也作为解决方案中的项目)。

Yesterday, suddenly I got the 'The breakpoint will not currently be hit. No symbols have been loaded for this document.' message to appear in the IDE, but it only affects the Web Appliaction, I can debug the Silverlight and the Winform App.

昨天,我突然收到“当前不会命中断点”的消息。没有为此文档加载符号。消息出现在 IDE 中,但它只影响 Web Appliaction,我可以调试 Silverlight 和 Winform 应用程序。

What I tried / did to get rid of the message:

我尝试/做了什么来摆脱消息:

  • Reset Visual Studio Settings
  • removed all files in every \Temporary ASP.NET Files Folder (there is one for each 32bit/64bit and for Framework 2.0 and 4.0)
  • tried to debug using Visual Studio Integrated Web server - normally I use IIS, in the project output of the solution I deleted every obj and bin folders in every project folder
  • created a new solution and added all the projects to this new solution
  • deleted the solution suo file
  • created a new ASP.NET Web Application to test if it is a VS-installation issue => I can debug this new project/solution
  • rebooted the machine several times
  • repaired the vs.net installation
  • did an IISReset
  • removed the Web App from IIS
  • used the Create Virtual Directory Button under Project Properties of the Web App to create a new Web App in IIS
  • changed the Framework Version of every project from 3.5 to 4.0
  • Opened the Solution on my second machine => same behavior
  • crawled Microsoft Connect for bugs / similar issues
  • SPENT 7 HOURS.
  • 重置 Visual Studio 设置
  • 删除了每个 \Temporary ASP.NET Files 文件夹中的所有文件(每个 32 位/64 位和 Framework 2.0 和 4.0 都有一个)
  • 尝试使用 Visual Studio 集成 Web 服务器进行调试 - 通常我使用 IIS,在解决方案的项目输出中,我删除了每个项目文件夹中的每个 obj 和 bin 文件夹
  • 创建了一个新解决方案并将所有项目添加到这个新解决方案中
  • 删除了解决方案suo文件
  • 创建了一个新的 ASP.NET Web 应用程序来测试它是否是 VS 安装问题 => 我可以调试这个新项目/解决方案
  • 多次重启机器
  • 修复了 vs.net 安装
  • 做了一个 IISReset
  • 从 IIS 中删除了 Web 应用程序
  • 使用 Web App 的 Project Properties 下的 Create Virtual Directory 按钮在 IIS 中创建一个新的 Web App
  • 将每个项目的框架版本从 3.5 更改为 4.0
  • 在我的第二台机器上打开解决方案 => 相同的行为
  • 抓取 Microsoft Connect 中的错误/类似问题
  • 花了 7 个小时。

So, this happens the 2nd time in my life. last time I solved it by deleting Temporary ASP.NET Files Folder, but this time I need your help.

所以,这发生在我生命中的第二次。上次我通过删除临时 ASP.NET 文件文件夹解决了这个问题,但这次我需要你的帮助。

回答by Bevan

Whenever I've had this particular error come up, it's turned out that the folder that Visual Studio is loading assemblies from is different from the folder the web-application is running from.

每当我遇到此特定错误时,结果是 Visual Studio 从中加载程序集的文件夹与运行 Web 应用程序的文件夹不同。

That is, the application server is running the application from

也就是说,应用服务器正在从

C:\dev\MyApplication\bin 

but Visual studio is debugging from

但 Visual Studio 正在调试

C:\dev\MyOtherApplication\bin (or something along those lines, anyway).

Note - for various reasons, I do my debugging with IIS as the application host instead of the dinky standalone gizmo that most people use. This could influence the usefulness of my answer!

注意 - 由于各种原因,我使用 IIS 作为应用程序主机而不是大多数人使用的小巧的独立 Gizmo 进行调试。这可能会影响我的答案的有用性!

Update:

更新

For IIS the application server directory (i.e. C:\dev\MyApplicationabove) is the physical directoryconfigured for the web application - this can be controlled by changing basic settings for the app.

对于 IIS,应用程序服务器目录(即C:\dev\MyApplication上面的)是为 Web 应用程序配置的物理目录- 这可以通过更改应用程序的基本设置来控制。

For Visual studio the debugging directory (i.e. C:\dev\MyOtherApplicationabove) is the directory in which your svcfiles are found, usually the same directory as your csprojproject file.

对于 Visual Studio,调试目录(即C:\dev\MyOtherApplication上面的)是您的svc文件所在的目录,通常与您的csproj项目文件相同的目录。

回答by Sameh Deabes

The reason for what you faced is that the PDBs ("PDB stands for Program Database, a proprietary file format (developed by Microsoft) for storing debugging information about a program) are not up-to-date, this may be due to some reasons:

您面临的原因是 PDB(“PDB 代表程序数据库,一种用于存储程序调试信息的专有文件格式(由 Microsoft 开发)”)不是最新的,这可能是由于某些原因:

1- As Bevan said, you may be debugging another application!

1- 正如 Bevan 所说,您可能正在调试另一个应用程序!

2- You are debugging another version of the same application. For example, you attached a previously built application with the current version of the code for debugging without (re)building it.

2- 您正在调试同一应用程序的另一个版本。例如,您将先前构建的应用程序与当前版本的代码连接在一起,以便进行调试,而无需(重新)构建它。

Cleaning or Rebuilding the Solution solves such problems for me.

清理或重建解决方案为我解决了这些问题。

To make sure the problem is not yours, try debugging the same application with VS 2008 (I am afraid it may be a bug in VS 2010 -- it is still beta!).

为确保问题不是您的问题,请尝试使用 VS 2008 调试相同的应用程序(我担心这可能是 VS 2010 中的错误——它仍然是测试版!)。

回答by ITmeze

Try to set Silverlight Application Project as as a startup project: right click on project -> 'Set As Startup project. Then press F5 and see if you can catch breakpoints...

尝试将 Silverlight 应用程序项目设置为启动项目:右键单击项目 -> '设置为启动项目。然后按F5看看能不能抓断点...

Try to delete browsing/temp data in your browser each time You make changes to silverlight application

每次对 Silverlight 应用程序进行更改时,尝试删除浏览器中的浏览/临时数据

回答by Hans K

Right click on solution --> Properties

右键单击解决方案-> 属性

Look under Common Properties --> Startup Project

查看 Common Properties --> Startup Project

Select multiple startup projects

选择多个启动项目

select Start action on the projects you need to debug.

在需要调试的项目上选择开始操作。

回答by campo

I had the same problem, I was debugging my project, and i had to right click the project and select "new debug instance". I only needed to do this once, then after that it worked as normal.

我遇到了同样的问题,我正在调试我的项目,我不得不右键单击该项目并选择“新调试实例”。我只需要这样做一次,然后它就可以正常工作了。

回答by 2FD

Okay- here we go:

好的 - 我们开始:

(In a "silverlight app": please check first that silverlight is checked in "web" in your server project "properties"- If that didnt solve it then try this beneath)

(在“silverlight 应用程序”中:请首先检查您的服务器项目“属性”中的“web”中是否已检查 Silverlight - 如果这没有解决问题,请在下面尝试)

On first time do: run this first: devenv.exe /ResetSettings and 1: In top menu click on debug tag 2: click options and settings 3: In "debugging" and under "general" find "enable .net framework source stepping" 4: Tick the box. 5: And now all the symbols will be downloaded and reconfigured :)

第一次做:首先运行:devenv.exe /ResetSettings 和 1:在顶部菜单中单击调试标签 2:单击选项和设置 3:在“调试”和“常规”下找到“启用 .net 框架源步进” 4:打勾。5:现在所有的符号都将被下载并重新配置:)

If it happens again after the above just clear the folder where the symbols are:

如果在上述之后再次发生,只需清除符号所在的文件夹:

1: In top menu click on debug tag 2: click options and settings 3: In "debugging" and under "symbols" find the button "empty symbol cache" and click it.

1:在顶部菜单中单击调试标签 2:单击选项和设置 3:在“调试”和“符号”下找到按钮“空符号缓存”并单击它。

回答by angularsen

I had the same issue and after googling I found two typical solutions for this:

我遇到了同样的问题,在谷歌搜索后我找到了两个典型的解决方案:

  1. Make sure the Silverlight debugger is activated in the .Web project. Open up the project properties and select the Silverlight debugger under the "Web" tab.

  2. Restart Visual Studio and delete all bin and obj folders.

  1. 确保在 .Web 项目中激活 Silverlight 调试器。打开项目属性并选择“Web”选项卡下的 Silverlight 调试器。

  2. 重新启动 Visual Studio 并删除所有 bin 和 obj 文件夹。

But none of these worked for me. Then someone mentioned far down a thread to try using IE as the browser instead. This made debugging and breakpoints work again!

但这些都不适合我。然后有人在一个线程中提到尝试使用 IE 作为浏览器。这使得调试和断点再次起作用!

Edit:

编辑:

Later I have struggled with IE9 not working, because it attaches to the wrong process. Instead of manually attaching to the correct IE process every time, I found a neat trick:

后来我一直在为 IE9 无法工作而苦苦挣扎,因为它附加到错误的过程中。我发现了一个巧妙的技巧,而不是每次都手动附加到正确的 IE 进程:

  • Right-click one of the generated pages in the .Web project (.html or .aspx)
  • Click "Browse with..."
  • Set IE as default browser (will only affect Visual Studio's choice of browser)
  • 右键单击 .Web 项目(.html 或 .aspx)中生成的页面之一
  • 点击“浏览...”
  • 将 IE 设置为默认浏览器(只会影响 Visual Studio 对浏览器的选择)

Now, Visual Studio will launch IE when running the .Web project and attach to the correct process. That should do it.

现在,Visual Studio 将在运行 .Web 项目时启动 IE 并附加到正确的进程。那应该这样做。

回答by Denis Vuyka

If you are having problems with Silverlight projects the solution can be fairly simple. According to my experience in many cases debugging symbols are not being loaded due to the new ".xap" files not being deployed to temporary folder (either internal VS Cassini or IIS Express). In this situation full rebuilds or resetting VS settings won't help. The easiest solution is just to delete temporary internet files within your browser. If you are using IE for Silverlight development and testing I would recommend switching on "Delete browsing history on exit" option in order not to have such issues in the future.

如果您在 Silverlight 项目中遇到问题,解决方案可能相当简单。根据我的经验,在许多情况下,由于新的“.xap”文件未部署到临时文件夹(内部 VS Cassini 或 IIS Express),因此未加载调试符号。在这种情况下,完全重建或重置 VS 设置将无济于事。最简单的解决方案是删除浏览器中的临时 Internet 文件。如果您使用 IE 进行 Silverlight 开发和测试,我建议您打开“退出时删除浏览历史记录”选项,以免将来出现此类问题。

回答by Adam

I tried lots of things. What worked for me. I made the Silverlight app the 'Set as Startup Project' by right clicking on the project. Then I tried to run it (which obviously failed as it relied on RIA Services to a web server that was not running) And then I reset the Web project as the Startup Project .. and hey presto .. it is all working.

我尝试了很多东西。什么对我有用。我通过右键单击项目将 Silverlight 应用程序设置为“设置为启动项目”。然后我尝试运行它(这显然失败了,因为它依赖 RIA 服务到未运行的 Web 服务器)然后我将 Web 项目重置为启动项目 .. 嘿,presto .. 一切正常。

回答by BeauJest

Another anecdote which might be useful-

另一个可能有用的轶事-

I encountered this problem when one of my projects was using file references from a Release output folder. When the build results were placed in a Goods folder, these Release dlls were overwriting the Debug dlls.

当我的一个项目使用来自 Release 输出文件夹的文件引用时,我遇到了这个问题。当构建结果放在 Goods 文件夹中时,这些 Release dll 会覆盖 Debug dll。

The solution was to make sure in the csproj file, my reference's HintPath was

解决方案是确保在 csproj 文件中,我参考的 HintPath 是

<HintPath>..\..\Core\Goods\$(Configuration)\MyFramework.dll</HintPath>

<HintPath>..\..\Core\Goods\$(Configuration)\MyFramework.dll</HintPath>

and not

并不是

<HintPath>..\..\Core\Goods\Release\MyFramework.dll</HintPath>

<HintPath>..\..\Core\Goods\Release\MyFramework.dll</HintPath>