Cannot debug EmbeddedResource views loaded via custom VirtualPathProvider

后端 未结 2 1119
鱼传尺愫
鱼传尺愫 2021-02-14 16:58

I have written a custom VirtualPathProvider (source here) which will return content from EmbeddedResources, or from the original file if it has been told where to find it (this

2条回答
  •  北海茫月
    2021-02-14 17:26

    I tried playing with your code a bit, and when I added a test aspx in the resources, debugging appeared to work fine. I was able to set a BP in Page_Load, and it git there.

    You can see my change in https://github.com/davidebbo/EmbeddedResourceVirtualPathProvider

    Note that I disabled the fallback logic as I wanted to focus on the embedded case, though I don't think that makes a difference.

    Note that I'm using VS2012, so I also had to upgrade the project/sln (but they'll still work in 2010).

    The reason ASP.NET is generating the http line pragma is that it can't find the physical aspx file at the standard location (i.e. what MapPath would return). There is actually a little known way to always turn on this behavior: set urlLinePragmas=true in the section (http://msdn.microsoft.com/en-us/library/system.web.configuration.compilationsection.urllinepragmas.aspx).

提交回复
热议问题