我使用的是OpenNetCF's IoC framework,我的Program类中的代码如下:
public class Program : SmartClientApplication<Container>
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[MTAThread]
static void Main()
{
if (!string.Equals(RegionInfo.CurrentRegion.EnglishName, "New Zealand") ||
!string.Equals(TimeZone.CurrentTimeZone.StandardName, "New Zealand Standard Time"))
{
MessageBox.Show("Please set your regional and time zone settings to New Zealand.");
return;
}
AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;
new Program().Start();
}
static void CurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
if (Debugger.IsAttached)
{
Debugger.Break();
}
}
}我已经将OpenNETCF复制到我的解决方案中,我预计当调用Program().Start()时,它会跳转到这里的start方法,所以我在它上面设置了一个断点:
public abstract class SmartClientApplication<TShell>
where TShell : Form
{
/// <summary>
/// This method loads the Profile Catalog Modules by calling GetModuleInfoStore which, unless overridden, uses a DefaultModuleInfoStore instance.
/// It then creates an instance of TShell and calls Application.Run with that instance.
/// </summary>
public void Start()
{
// load up the profile catalog here
IModuleInfoStore store = GetModuleInfoStore();
Start(store);
}奇怪的是,它从来没有达到临界点。
我觉得这很奇怪,所以我点击Program导航到SmartClientApplication的继承引用中的定义。
这打开了一个与我期望的文件完全不同的文件,如下所示:
using OpenNETCF.IoC;
using System;
using System.Windows.Forms;
namespace OpenNETCF.IoC.UI
{
public abstract class SmartClientApplication<TShell> where TShell : System.Windows.Forms.Form
{
protected SmartClientApplication();
public virtual void AddServices();
protected virtual void AfterShellCreated();
public virtual IModuleInfoStore GetModuleInfoStore();
public virtual void OnApplicationRun(Form form);
public virtual void OnModuleLoadComplete(string moduleName);
public void Start();
public void Start(string profileCatalog);
}
}名称相同,但内容似乎不包含任何实现。当我看到它的位置时,它是这样的:
C:\Users\myusername\AppData\Local\Temp\7212$OpenNETCF.IoC.UI.dll$v2.0.50727\OpenNETCF.IoC.UI.SmartClientApplication.cs
所以这就解释了为什么它没有命中断点,但我想知道的是,为什么它甚至要查看这个疯狂的文件,而不是它应该是的文件。
发布于 2012-01-06 08:11:21
听起来您的开发机器上有源代码和PDB的多个副本。如果你构建了一个IoC示例,然后批量复制了文件夹,包括obj和bin文件夹,就可能发生这种情况。
解决方案(或者至少是开始)是执行以下操作:
https://stackoverflow.com/questions/8751495
复制相似问题