Closed FrankLakmann closed 5 years ago
Thanks. I need to take a look but I suspect that the struct itself is duplicated instead of being boxed.
Thank you. In the meantime I tried to make it ignore structs by spreading ExcludeAdvices in our code. Unfortunately structs can't get these: Attribute 'ArxOne.MrAdvice.Annotation.ExcludeAdvices' is not valid on this declaration type. It is only valid on 'class, method' declarations.
Most are just autoprops that don't make much sense and can be changed to public fields.
I'll try to provide at least a fix for the ExcludeAdvices
today.
Thank you. I was able to change autoprops to fields and the remaining structs to classes. So it's not urgent for us but it would be good to have the exclude option.
Version 2.8.4 (just released) excludes structs from weaving... Until 2.8.5 handles them correctly 😉
Thanks alot
This seems to be fixed (I wrote 2 tests, which is humongous). Sometimes I surprise myself by being so fast 😄
Also good luck to access struct data during advice: if you cast the Target
to your struct in pointcut, then you will change your local copy. The only ways I found are using reflection or a dynamic
.
Hi,
after dorian reported one issue with structs (https://github.com/ArxOne/MrAdvice/issues/108) we found another one: Structs with auto properties or methods seem to just skip the logic when a MethodAdvice aspect is applied.
results in x=0.
This is the code after weaving according to ILSpy:
Here is a demo example: https://github.com/FrankLakmann/MrAdviceTest Sorry I wasn't able to put it in one cs file because of StackOverflowExceptions. Thank you