postsharp / Metalama

Metalama is a Roslyn-based meta-programming framework. Use this repo to report bugs or ask questions.
164 stars 4 forks source link

VS Extension doesn't work with Metalama.Extensions.DependencyInjection NuGet package. #270

Closed ikatol closed 3 months ago

ikatol commented 4 months ago

Hello,

Extension woks with just basic Metalama.Framework NuGet package, but as soon as I introduce Metalama.Extensions.DependencyInjection package, the "show Metalama diff" gives an error:

StreamJsonRpc.RemoteInvocationException: [A]Metalama.Framework.Engine.Aspects.TransitiveAspectsManifest cannot be cast to [B]Metalama.Framework.Engine.Aspects.TransitiveAspectsManifest. Type A originates from 'Metalama.Framework.Engine.4.8.0, Version=2024.0.9.0, Culture=neutral, PublicKeyToken=772fca7b1db8db06' in the context 'Default' at location 'C:\Users\user\AppData\Local\Temp\Metalama\Extract\2024.0.9.0-b54a8823\core\Metalama.Framework.Engine.4.8.0.dll'. Type B originates from 'Metalama.Framework.Engine.4.4.0, Version=2024.0.9.0, Culture=neutral, PublicKeyToken=772fca7b1db8db06' in the context 'Default' at location 'C:\Users\user\AppData\Local\Temp\Metalama\Extract\2024.0.9.0-b54a8823\core\Metalama.Framework.Engine.4.4.0.dll'. at StreamJsonRpc.JsonRpc.d__151`1.MoveNext()...

Metalama log.txt

I tried looking around the net if the VS extension is not compatible with the DI package, but couldn't find any relevant answers and from what I can see, it looks like a bug. I also tried installing an earlier version of DI package (2023.3.10), but then it just froze trying to generate the diff file.

svick commented 4 months ago

Thanks for the report, this is indeed a bug in Metalama. I will look into it.

svick commented 4 months ago

This exception is happening when you reference the old DI package and also a new version of Metalama. I think referencing consistent versions of packages (e.g. 2024.0.*) everywhere should work around the issue.

addabis commented 3 months ago

This bug has been fixed in Metalama 2024.0.10.