开发者

Throw an exception without reference its host assembly?

I have an assembly that is a plugin to a system A (it implements IASystemPlugin interface). The system A is a component of a system B. I want to throw an exception from the plugin to th开发者_Python百科e System B level. Unfortunately, both systems A and B handle all known exceptions and re-throw all unknown ones, so I have to throw B.SystemBException instance.

As a system A client, I had no references to B classes and it's better if I will not (all references, except system ones, should be registered on the level A, it means 30+ B assemblies to be registered). In this case, am I able to instantiate the looking-very-simple B.SystemBException class?

Any hacking methods will be appreciated.

Regards,


I am guessing you might be able find the class through Reflection and create an instance of it. But, Are you sure you want to do this? I am assuming that the system interfaces were built to accomodate such content?

In any event, I assume you have access to that class since you are getting loaded by the other assembly. See this for starting it out: http://www.codeproject.com/KB/dotnet/Reflection.aspx

Let me know if you need more details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜