OpenNetCF の IoC フレームワークを使用しており、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);
}
不思議なことに、ブレークポイントにヒットすることはありません。
これはおかしいと思ったので、[プログラム] をクリックして、継承参照から 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
これで、ブレークポイントに到達しなかった理由が説明されましたが、知りたいのは、なぜこのクレイジーなファイルを見ているのに、本来あるべきファイルではないのかということです。