There doesn't seem to be anything wrong with the code. The problem lies elsewhere. Possibly the project is reloaded or the scene was deleted invalidating your Scene object.
FWIW, this snippet works fine for me (Xpression Developer v10.0).
private void button2_Click(object sender, EventArgs e)
{
xpEngine engine = new xpEngine();
xpScene scene;
string fontName = "Font1";
if (engine.GetSceneByName("MyScene", out scene) && scene.Project.FontExistsByName(fontName))
{
xpFont font;
scene.Project.GetFontByName(fontName, out font);
fontNameDisplay.Text = font.Name;
}
}
------------------------------
JohnCorigliano
Senior Software Engineer
ISC
------------------------------