Strange exceptions in Castle proxies occur only when dotMemory is attached

I'm using an in-house IoC library that uses Castle.Core ProxyGenerator. All is fine (and has been fine) unless I'm attached to the application via dotMemory. When attached, I get a bunch of TargetInvocationExceptions and TypeLoadExceptions in places where our proxies (used for factory interfaces) are called for methods that have a type parameter (e.g. CustomThing<T> CreateCustomThing<T>( int myArg )).

In every case of a proxy method containing a type parameter, I get an exception stating that GenericArguments[0] violates the constraint of type parameter 'T'. This is despite not having any constraints on the type parameter specified in code.

Does dotMemory somehow modify the logic of Castle.Core and/or inject type constraints into the proxies it generates?

I can try to create a minimal repo but was wondering if anything jumped out as obvious. It looks like dotMemory uses Castle.Core and so I updated my app to reference v4.4.1 but no change in behavior :/

0
1 comment

Hello,

Thank you for contacting us. Unfortunately, we haven't reproduced the same issue with Castle.Core. Could you please create project sample for us?

You can upload it to our ftp: https://uploads.services.jetbrains.com/

0

Please sign in to leave a comment.