No, the event isn't a custom event declaration. Here is the code from
the assembly I'm dynamically loading:
--- Begin Code Block ---
namespace PlayEngine
{
public class D3DVideoTask : Task, IVideoTask
{
public D3DVideoTask() : base()
{
}
public override void Run()
{
Application.DoE vents();
}
public void CreateViewport( )
{
viewport = new Form();
viewport.Show() ;
viewport.Closin g += new CancelEventHand ler(viewport_Cl osing);
}
protected override void Start()
{
}
protected override void Stop()
{
}
protected override void Suspend()
{
}
protected override void Resume()
{
}
protected void viewport_Closin g(object sender, CancelEventArgs
e)
{
if (Closing != null)
{
Closing(this);
}
}
private void InitalizeDirect 3D()
{
...
}
public event VideoEventHandl er Closing; // <- troublesome event
private Form viewport;
private Device d3dDevice;
}
}
--- End Code Block ---
And here is the line of code used to access the class from this
assembly:
Task task = (Task)Activator .CreateInstance (Assembly.Load( "D3DVideoTask") .GetType("PlayE ngine.D3DVideoT ask",
true));
Note that it appears to be the GetType() method that throws the
exception.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in message news:<Oi******* *******@TK2MSFT NGP10.phx.gbl>. ..
Eli,
The only thing that I can think of is that there is a custom event
declaration (using add and remove) instead of the normal event declaration.
Is this assembly one that you have the code for, or is it something you can
not modify? If you have the code for it, then can you post it (if not the
assembly itself) and the code you are trying to use to access it?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Eli Block" <eb****@gmail.c om> wrote in message
news:76******** *************** **@posting.goog le.com... When getting a type from a dynamically loaded assembly using
Assembly.GetTyp e, I receive the following exception:
An unhandled exception of type 'System.TypeLoa dException' occurred in
playengine.dll
Additional information: Method add_Closing in type
PlayEngine.D3DV ideoTask from assembly D3DVideoTask,
Version=1.0.163 2.5152, Culture=neutral , PublicKeyToken= null does not
have an implementation.
I'm not sure where it is getting this 'add_Closing' method from. The
class does have an event called 'Closing'. I tried defining custom add
and remove accessors for the event but that did not make the exception
go away. What is the problem?