Sorry, did not figure out how to better formulate the question. I understand with reflection. I have my own pseudo-WAMP protocol bike =) I want to remotely call methods using RPC. And since I understand reflection, I want to make the application extensible. Those. so that later I could just write a plugin library. Throw it into the folder with the wamp-server and use it remotely.
Actually, the problem arose when I use a link to some other library in my library. The server does not see the second library by itself, and therefore it cannot execute the method from my library.
How besides my library to connect also those to which mine refers?
Method that is now:
private string CallInvoke(WebSocketSession session, Call call) { try { string filepath = Environment.CurrentDirectory + "/Plugins/" + call.PluginFileName; //Если файл плагина не найден if (!File.Exists(filepath)) { CallError callError = new CallError(call.CallId, "Plugin file not found.\r\n(" + filepath + ")"); return JsonSerialize(callError); } Assembly asm = Assembly.LoadFile(filepath); Type _class = null; MethodInfo _method = null; var types = asm.GetTypes(); //Если в плагине нет нужного класса if (types.Count(x => x.Name == call.ClassName) == 0) { CallError callError = new CallError(call.CallId, "Class \"" + call.ClassName + "\" not found in assembly \"" + asm.FullName + "\"."); return JsonSerialize(callError); } _class = types.Single(x => x.Name == call.ClassName); var methodInfos = _class.GetMethods(); //Если в классе нет нужного метода if (methodInfos.Count(x => x.Name == call.MethodName) == 0) { CallError callError = new CallError(call.CallId, "Method \"" + call.MethodName + "\" not found in class \"" + call.ClassName + "\"."); return JsonSerialize(callError); } _method = methodInfos.Single(x => x.Name == call.MethodName); object result = null; if (call.Params is null) result = _method.Invoke(null, null); else result = _method.Invoke(null, new object[] { call.Params }); CallResult callResult = new CallResult(call.CallId, result); return JsonSerialize(callResult); }catch(Exception ex) { CallError callError = new CallError(call.CallId, ex.Message); return JsonSerialize(callError); } }