Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the DynamicProxyGenAssembly2 assembly?

Tags:

I use Moq for my unit tests. To test internal interfaces I have to declare the InternalsVisibleTo attribute to the DynamicProxyGenAssembly2 assembly.

We run our tests obfuscated, which is useful because we could found some problems with obfuscation with this approach. Caused by the DynamicProxyGenAssembly2 assembly my component is not obfuscated.

Therefore I need to know what is the DynamicProxyGenAssembly2 assembly? I could not found it anywhere on my disk. Is it compiled into the moq.dll or is it generated at runtime? Maybe if I know what this assembly I we coul find a way to workaround my problem. Has somebody encountered the same problem?

Please dont suggest that we need to run our tests unobfscated. At this point this is no option.

EDIT

The DynamicProxyGenAssembly2 is generated at runtime. To satisfy the Dotfuscator is have put an empty dll beside Moq. Additionally we had to modify the Castle.Core dll to use your public key. The last problems we had was answered here. With this we could run all our tests obfuscated without problems.

Regards, Yggdrasil.

like image 642
Yggdrasil Avatar asked Mar 14 '13 09:03

Yggdrasil


1 Answers

DynamicProxyGenAssembly2 is a temporary assembly built by mocking systems that use CastleProxy like Moq or NSubsitute. It is generated when the mock is needed and disposed of after the tests are finished.

As for the Expose Internals method than there is a RhinoMocks solution that would work for your Moq one with minimal changes:

http://ayende.com/Wiki/Rhino+Mocks+-+Internal+Methods.ashx?AspxAutoDetectCookieSupport=1

like image 164
ChargerIIC Avatar answered Sep 19 '22 12:09

ChargerIIC