Capgemini / Cauldron

C# Toolkit
MIT License
76 stars 18 forks source link

Fody: Cauldron.Interceptors not found #84

Open a11smiles opened 4 years ago

a11smiles commented 4 years ago

So, I've added Cauldron.Interceptors.Fody 3.2.3 and Fody 4.2.1 (I'm still using MSBuild 15) to my project via Nuget.

My FodyWeavers.xml file looks like:

<?xml version="1.0" encoding="utf-8"?>
<Weavers>
  <Cauldron.Interception />
</Weavers>

However, when I try to build, I get the following error: Fody: No weavers found for the configuration entries Cauldron.Interception. Add the desired weavers via their nuget package.

a11smiles commented 4 years ago

1) So, I completely removed Fody and Cauldron.Interceptors. 2) I then only installed Cauldron.Interceptors and recognized that an older version of Fody is being referenced as a dependency. 3) I then re-added FodyWeavers.xml 4) Tried to build and got the following exception:

Exception:
Failed to execute weaver C:\Users\joshua\.nuget\packages\cauldron.interception.fody\3.2.3\netclassicweaver\Cauldron.Interception.Fody.dll
Type:
System.Exception
StackTrace:
   at InnerWeaver.ExecuteWeavers()
   at InnerWeaver.Execute()
Source:
FodyIsolated
TargetSite:
Void ExecuteWeavers()
Exception has been thrown by the target of an invocation.
Type:
System.Reflection.TargetInvocationException
StackTrace:
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Cauldron.Interception.Fody.ModuleWeaver.ExecuteInterceptionScripts(Builder builder)
   at Cauldron.Interception.Fody.ModuleWeaver.OnExecute()
   at Cauldron.Interception.Cecilator.WeaverBase.Execute()
   at InnerWeaver.ExecuteWeavers()
Source:
mscorlib
TargetSite:
System.Object InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
Object reference not set to an instance of an object.
Type:
System.NullReferenceException
StackTrace:
   at Cauldron.Interception.Cecilator.Method.AddLocalVariable(String name, VariableDefinition variable)
   at Cauldron.Interception.Cecilator.Method.GetOrCreateVariable(TypeReference type, String name)
   at MethodBuilderInfoItem`2..ctor(AttributedMethod attribute, T1 interfaceA, T2 interfaceB)
   at Weaver_Method.<>c.<InterceptMethods>b__5_4(AttributedMethod y)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at MethodBuilderInfo`1..ctor(MethodKey key, IEnumerable`1 items)
   at Weaver_Method.<>c.<InterceptMethods>b__5_2(IGrouping`2 x)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Weaver_Method.InterceptMethods(Builder builder)
Source:
Cauldron.Interception.Cecilator
TargetSite:
Mono.Cecil.Cil.VariableDefinition AddLocalVariable(System.String, Mono.Cecil.Cil.VariableDefinition)

FYI...I've tried this in both VS2017 and VS2019 with the same results.

a11smiles commented 4 years ago

I've removed everything, then added the nuget package:

Capgemini.Cauldron.Interceptors

However, my interceptors no longer fire.

BTW, this is a .NET Standard 2.0 application being compiled in VS2017.

alkozlov commented 4 years ago

I also faced with this problem and did not find a solution. VS 2017, .NET Framework 4.5

SimonCropp commented 4 years ago

Cauldron needs to be updated to the latest version of Fody. if u want to use Cauldron with Fody i recommend sticking to v3.3.5 of Fody

pellispolaramp commented 4 years ago

I've done a lot of installing/ uninstalling, nothing seems to work, I'm still faced with:

Severity Code Description Project File Line Suppression State Error Fody: Could not find a weaver named 'Cauldron.BasicInterceptors'. If you have nuget package restore turned on you probably need to do a build to download the weavers. Alternatively you may have added a weaver to your 'FodyWeavers.xml' and forgot to add the appropriate NuGet package. This url may provide more information http://nuget.org/packages/Cauldron.BasicInterceptors.Fody/ .
NOTE: this url doesn't exist.

My weavers: <?xml version="1.0" encoding="utf-8"?>

SimonCropp commented 4 years ago

@pellispolaramp i think this project is abandoned. i recommend not using it until you confirm the status

pellispolaramp commented 4 years ago

Got it, thanks Simon. Is there a version in Nuget I can download and use? That is, a combination of Cauldron, Fody, etc. that will allow me to use it? Alternatively, what do you suggest as an alternative to this? PostSharp looks like the most likely candidate, however we'd have to pay for that.

SimonCropp commented 4 years ago

just to be clear i am not a maintainer of this project

That is, a combination of Cauldron, Fody, etc. that will allow me to use it?

you should be able to use Cauldron with Fody 3.2.10 (an most likely 3.X). But I would not recommend it since any bug syou find will be difficult for you to get fixed.

Another option would be for you to fork the project and start a new one under a different name.

PostSharp looks like the most likely candidate, however we'd have to pay for that.

Yes postsharp would be a good candidate. And FWIW you should be paying for Fody as well https://github.com/Fody/Home#community-backed

reflection-emit commented 4 years ago

Hi guys... I left Capgemini a while now and the guy I left the project seems to be not doing anything with it. Since I cannot just use the Capgemini packages I have to fork the project and release it under a new name. Give me about a week please to fix this.

SimonCropp commented 4 years ago

u cant get them to transfer ownership of the repo and nugets?

reflection-emit commented 4 years ago

Getting the nugets won‘t be a problem. Transfering ownership of the repo would be though, because finding out who is in charge / admin is not easy. The nugets and the source codes have Capgemini everywhere ( in namespaces, in descriptions ... ) ... I cannot use that name... The legal department would not be happy about that. So I have to rename the nugets and change at least some namespaces.

reflection-emit commented 4 years ago

Update... I extracted the Fody part from the Cauldron stuff... I got it now working for the newest Fody version. I will not be naming it Cauldron apparently... So if you have any naming suggestions :)

After the first release I will fix the reported bugs one by one.

chucker commented 3 years ago

@reflection-emit did you ever ship this?