Method Not Found from Loaded Assembly

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Method Not Found from Loaded Assembly



I have an application that loads the assembly of another application and invokes methods from that assembly for test purposes. Below is a generic example of this code.


testAssembly = Assembly.LoadFrom( path );
var classes = testAssembly.GetTypes();
Type mainForm = classes.Where( c => c.Name == "MainForm" ).SingleOrDefault();
var form = Activator.CreateInstance( mainForm, null );

Type secondForm = classes.Where( c => c.Name == "SecondForm " ).SingleOrDefault();
var sf = Activator.CreateInstance( secondForm , new object { form } );

MethodInfo secondFormMethod = eventList.GetMethod( "SecondFormMethod " );
secondFormMethod.Invoke( sf, new object { } );



This works to a point. The issue is that when the method is fired it eventually leads to a library referenced from the secondFormMethod and comes back with a "Method not found" error.



None of my references seem to be broken in either application.



This method works when fired from the second application I am trying to manipulate.



Not sure what I might be doing wrong.









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Better method to check all objects' parameters with a single call

Visual Studio Code: How to configure includePath for better IntelliSense results