[Mono-list] Problem using Assembly.GetTypes()

Pablo Testa ziwyek at hotmail.com
Tue Oct 6 20:25:20 EDT 2009



Hi,
I have problem using Assembly.GetTypes() in my application.My application is a game that uses mono as scripting language. I follow the embed examples, and i got it running.I can create mono object, and get my c code got called from mono.All is working as expected, but when i try to call GetTypes(), i got the following exception: "The classes in the module cannot be loaded."
I got the following log:
Game.Game()Assembly GhostAssembly H2OGame.Game() Got assemblyThe classes in the module cannot be loaded.Game.Game() - Done
The assemblies show themselves in AppDomain.CurrentDomain.GetAssemblies().I dont know what is happening here. I Pass my dll with migration verifier and the test is ok.
Any Ideas?
Thanks


Here is my code:

using System;using System.Reflection;using System.Runtime.CompilerServices;using H2O.Locale;using H2O.Drawing;using Ghost;
namespace H2O.Game{		public class Game	{		private bool	m_fullScreen;		private bool	m_autoSave;		private float	m_autoSaveDelay;		private Lang	m_language;		private bool	m_pause;		private bool	m_autoPause;		private Draw	m_draw;
		[MethodImplAttribute(MethodImplOptions.InternalCall)]		internal extern static void GameLog( string _log );

		public static void Log(string _log)		{			GameLog( _log );		}
		public Game( Draw _draw )		{			Log( "Game.Game()" );			Assembly assembly = GetAssembly("H2O" );			Log( "Game.Game() Got assembly" );
					try			{
				Type[] types = assembly.GetTypes();
				foreach (Type type in types)				{					Log("Type: " + type.Name);				}			}			catch (Exception e)			{				GameLog( e.Message  );			}
			m_draw = _draw;
			Log( "Game.Game() - Done" );		}
		private Assembly GetAssembly( string _assemblyName )		{			foreach( Assembly assembly in AppDomain.CurrentDomain.GetAssemblies() )			{				GameLog("Assembly " + assembly.GetName().Name );
				if ( _assemblyName == assembly.GetName().Name )				{					return assembly;				}			}
			return null;		}

		public bool Pause		{			get { return m_pause; }			set { m_pause = value; }		}
		public Lang Language		{			get { return m_language; }			set { m_language = value; }		}
		public bool FullScreen		{			get { return m_fullScreen; }			set { m_fullScreen = true; }		}
		public bool AutoSave		{			get { return m_autoSave; }			set { m_autoSave = value; }		}
		public float AutoSaveDelay		{			get { return m_autoSaveDelay; }			set { m_autoSaveDelay = value; }		}
	}}
 		 	   		  
_________________________________________________________________
Hotmail: Trusted email with powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141665/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20091006/e85612a5/attachment.html 


More information about the Mono-list mailing list