Problem using Dependency Injection (Autofac) with Mogre

paddy3k

16-07-2008 13:23:55

Hi,

I'm building a small game using Mogre. I'm registerung my components with the following code :


var builder = new ContainerBuilder();

builder.Register<Log>().As<ILog>();
builder.Register<Audio>().As<IAudio>();
builder.Register<Controller>().As<IController>();
builder.Register<View>().As<IView>();
builder.Register<GUI>();

using (var container = builder.Build())
{
Application.ThreadException += Application_ThreadException;
Application.EnableVisualStyles();

Application.SetCompatibleTextRenderingDefault(false);

Application.Run(container.Resolve<GUI>());
}


This compiles without any error so far. The problem is in the "View"
class :


using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;

using Mogre;

namespace Player.View
{
public class View : IView
{
public Root root;
public SceneManager sceneMgr;

protected Camera camera;
protected Viewport viewport;
protected RenderWindow window;
protected IntPtr _handle;

const float TRANSLATE = 200;
const float ROTATE = 0.2f;
bool mRotating = false;
Vector3 mTranslation = Vector3.ZERO; // <----------- here
is the problem
Point mLastPosition;

public bool Running { get; set; }

.......

}


Vector3 is a class inside the Mogre namespace. If I comment out these
line, all works fine. But why I get FileNotFound exception else ?

The error occurs also if I want to Register any class inside the Mogre
Framework. So for example : builder.Register<Vector3>() also ends
up with these FileNotFound exception.

Can someone help ??

Many thanks in advance :-)
paddy3k

paddy3k

23-07-2008 09:09:18

solved it. Nasty bug, it appears only if I use the Debug Mogre.dll ... seams to be an Bug (??) in there. If I use the Release DLL of Mogre all works as it should :-)