TypeLoadException not managed [RESOLVED]

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
AlmostNoob
Posts: 13
Joined: Sun Jan 11, 2009 6:34 pm

TypeLoadException not managed [RESOLVED]

Post by AlmostNoob »

Hi Norbo, i have this damn error at game.Run() in Program.CS:

Impossible loading 'BEPUphysics.Space' type from assembly 'BEPUPhysics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. (I use italian version, i translated it... :wink: )

I'm sure i downloaded the right XNA 2.0 version of BEPUphysics.dll.

What's the matter?? :?:
Last edited by AlmostNoob on Tue Jan 13, 2009 11:43 am, edited 1 time in total.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: TypeLoadException not managed

Post by Norbo »

I am unable to replicate the issue using the XNA 2.0 .dll on the website and a XNA 2.0 project. Have you tried upgrading the project to XNA 3.0 and using the XNA 3.0 BEPUphysics.dll?
AlmostNoob
Posts: 13
Joined: Sun Jan 11, 2009 6:34 pm

Re: TypeLoadException not managed

Post by AlmostNoob »

Well, i just have some other project in 2.0, it's quite annoying to me transpose that in 3.0. I don't know if i can have multiple install (2.0 AND 3.0).
Anyway, i'm just testing your dll, it's a brand new project, only with a Space and a Box initialization...

(By the way, what's the method to use my own .x models? I suppose some .initializeData one...)
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: TypeLoadException not managed

Post by Norbo »

Having both XNA GS 3.0 and 2.0 shouldn't pose any problems; I have both currently installed to no ill effect. I don't know of any reasons off the top of my head why it's giving you that error right now, though.

One of the StaticTriangleGroup initializeData method takes a Model. The Model can be loaded in using the normal XNA content pipeline. Sometimes, it is more robust to create a custom content processor which loads in a list of vertices and indices from a model and pass those into the other initializeData method.
AlmostNoob
Posts: 13
Joined: Sun Jan 11, 2009 6:34 pm

Re: TypeLoadException not managed

Post by AlmostNoob »

What the...?! I tried with XNA 3.0, having same exception!!
Take a look to my code, i only initialized Space and a box Model, yet not implemented graphics but it should run without errors...

Code: Select all

using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using BEPUphysics;

namespace BEPUPhysics
{
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        Model boxModel;
        Space Space;
        StaticTriangleGroup box;
                
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }

        protected override void Initialize()
        {   
            Space = new Space(); 
            box = new StaticTriangleGroup(0, 0, 0, 0, 0, 0);  //I know, it has no sense (after all, i'm almost noob! :) ) for now i only want to debug the exception error...
            box.initializeData(boxModel);
            box.addToSpace(Space);
            Space.add(box);

            base.Initialize();
        }

        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            boxModel = Content.Load<Model>("box");
            
        }

        protected override void UnloadContent()
        {

        }

        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            Space.update(gameTime);

            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            graphics.GraphicsDevice.Clear(Color.CornflowerBlue);

            base.Draw(gameTime);
        }
    }
}
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: TypeLoadException not managed

Post by Norbo »

Everything on the code side looks fine; this is likely caused something in the project set up but I'm not sure what. Posting the test project might help me locate the issue.
AlmostNoob
Posts: 13
Joined: Sun Jan 11, 2009 6:34 pm

Re: TypeLoadException not managed

Post by AlmostNoob »

I uploaded the entire project directory on my website. This is the link: http://ildiario.altervista.org/Extra/TestProject.zip
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: TypeLoadException not managed

Post by Norbo »

Changing the name to something besides BEPUPhysics should fix that issue. It seems it is getting confused and looking into your similarly named assembly for BEPUphysics types. I changed it to BEPUPhysicsTest in the assembly name field of the project properties and it works.
AlmostNoob
Posts: 13
Joined: Sun Jan 11, 2009 6:34 pm

Re: TypeLoadException not managed

Post by AlmostNoob »

GREAT!! Now it works, thank you!! Anyway, what a strange issue... :D
I changed the thread name adding [RESOLVED], maybe it can be useful for someone...
Post Reply