I'm using OpenNetCF's IoC framework and the code in my Program class looks like:
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();
}
}
}
I've copied OpenNETCF into my solution and I was expecting when Program().Start() was called it would jump to the start method here so I set a break point on it:
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);
}
Strangely it never hit the break point.
I thought this was strange so I clicked in Program to navigate to the definition from the inheritance reference to SmartClientApplication.
This opened a completely different file to the one I was expecting and looks like:
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);
}
}
Same name but the contents don't seem to contain any implementation. When I see where its location it is something like:
C:\Users\myusername\AppData\Local\Temp\7212$OpenNETCF.IoC.UI.dll$v2.0.50727\OpenNETCF.IoC.UI.SmartClientApplication.cs
so that explains why it didn't hit the breakpoint but what I want to know is why it's even looking at this crazy file and not the one it should be.