MethodAccessException on Xbox only
Posted: Tue Oct 23, 2012 3:51 pm
I'm pulling my hair out with this one, and it might be to do with my understanding of the C# language more than anything but I thought this the best place to ask...
I've basically modified the CharacterController class so it derives from Cylinder rather than holding reference to one internally, which means it no longer derives from Updateable (but Cylinder effectively implements ISpaceUpdateable anyway). I still override the OnAdditionToSpace and OnRemoveFromSpace methods as the original CharacterController does but now it has to be 'protected override' rather than 'public override'.
All seems to work very... on my PC... but on the Xbox I get the error...
"An unhandled exception of type 'System.MethodAccessException' occurred in BEPUplugin.dll"
(BEPUplugin.dll is my BEPU wrapper for SunBurn which I'm currently in the process of updating)
It occurs at:
... at the end of the Space.Add() method and ONLY on the Xbox?!?
Is it because EntityBase implements ISpaceObject.OnAdditionToSpace explicitly (and privately)? But then I don't get how it works ok for any other entities I have???? I'm clearly not understanding something, I'm just not sure what. Your help would be greatly appreciated as always.
Thanks.
CJ.

p.s. It's definitely caused by my overriding of OnAdditionToSpace in my CharacterController class because I don't get the error if I comment it out.
I've basically modified the CharacterController class so it derives from Cylinder rather than holding reference to one internally, which means it no longer derives from Updateable (but Cylinder effectively implements ISpaceUpdateable anyway). I still override the OnAdditionToSpace and OnRemoveFromSpace methods as the original CharacterController does but now it has to be 'protected override' rather than 'public override'.
All seems to work very... on my PC... but on the Xbox I get the error...
"An unhandled exception of type 'System.MethodAccessException' occurred in BEPUplugin.dll"
(BEPUplugin.dll is my BEPU wrapper for SunBurn which I'm currently in the process of updating)
It occurs at:
Code: Select all
spaceObject.OnAdditionToSpace(this);
Is it because EntityBase implements ISpaceObject.OnAdditionToSpace explicitly (and privately)? But then I don't get how it works ok for any other entities I have???? I'm clearly not understanding something, I'm just not sure what. Your help would be greatly appreciated as always.
Thanks.
CJ.

p.s. It's definitely caused by my overriding of OnAdditionToSpace in my CharacterController class because I don't get the error if I comment it out.