Problem with public structs
See original GitHub issueHi,
We have some public structs declared in our project that is using MrAdvice and it seems the Assembly doesn’t have those struct anymore when we build it.
I have this struct: public struct ExempleKeyPair<TItemId, TItem>
with these properties:
public readonly TItemId ItemId;
public readonly TItem Item;
and this constructor:
public ExempleKeyPair(TItemId itemId, TItem item)
{
ItemId = itemId;
Item = item;
}
When I do this call : new ExempleKeyPair<int, string>(itemId, item)
I get this error when my advice is in the project System.TypeLoadException: Could not load type 'Application.BLL.Common.ExempleKeyPair``2' from assembly
If I put [ExcludeAdvices("*")]
on the struct it works. Also, if I change the type to a class it works.
So, there seems to be a problem with structs. I couldn’t use ExcludePointcutAttribute
to filter the struct.
I’m currently using the version 2.8.5 but I also tried with 2.8.4.
I could put [ExcludeAdvices("*")]
on every structs but I don’t want to modify all structs for the code to work. Could you tell me if there’s another way of if there could be a fix for that?
Thanks,
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Hi!
Sorry for the delay, yes I tried it and it works. It only happens when you try to have a generic struct, like a key pair.
Thanks for reporting the issue!