I am working with Photon (a server/client API) and I was creating a flat plane for objects to move on and I'm getting this strange error. My code runs as a service but I'm confused as to why the constructor for a Vector3F would need to create a message box. The error I get is this:
2012-03-21 08:13:58,165 [1] ERROR Photon.SocketServer.ApplicationBase [(null)] - System.TypeInitializationException: The type initializer for 'DigitalRune.Geometry.Pose' threw an exception. ---> System.TypeInitializationException: The type initializer for 'DigitalRune.Mathematics.Algebra.Vector3F' threw an exception. ---> System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
at System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, Boolean showHelp)
at System.Windows.Forms.MessageBox.Show(String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon)
at System.TypeInitializer.CreateInstance(Int32 guid, String assemblyName)
at DigitalRune.Mathematics.Algebra.Vector3F..cctor()
--- End of inner exception stack trace ---
at DigitalRune.Geometry.Pose..cctor()
--- End of inner exception stack trace ---
at DigitalRune.Physics.RigidBody..ctor(Shape shape, MassFrame massFrame, IMaterial material)
at DigitalRune.Physics.Simulation..ctor()
at AegisBornServer.Multi.SubServer.Region.BackgroundThreads.DigitalRunePhysicsBackgroundThread.Setup() in C:\temp\AegisBorn\AegisBorn\SubServer\Region\BackgroundThreads\DigitalRunePhysicsBackgroundThread.cs:line 42
at MMO.Photon.Application.PhotonApplication.Setup() in C:\temp\MMO\MMO.Photon\Application\PhotonApplication.cs:line 66
at Photon.SocketServer.ApplicationBase.PhotonHostRuntimeInterfaces.IPhotonControl.OnPhotonRunning() in c:\build\photon-socketserver-sdk_3.0\src\Photon.SocketServer\ApplicationBase.cs:line 575
The code attempting to do this is:
DigitalRune.Licensing.AddSerialNumber(...);
Simulation = new Simulation(); /// Error is on Simulation Creation
Simulation.Settings.Timing.MaxNumberOfSteps = 1;
Simulation.ForceEffects.Add(new Gravity());
Simulation.ForceEffects.Add(new Damping());
var rigidBody = new RigidBody(new PlaneShape(Vector3F.UnitY, 0))
{
Name = "GroundPlane",
Pose = Pose.Identity,
MotionType = MotionType.Static,
};
Simulation.RigidBodies.Add(rigidBody);