2

I'm trying to use a method interceptor so I can run a method before certain marked methods in my Xamarin app. I installed Fody from the NuGet Package Manager, then downloaded MethodBoundaryAspect.Fody.

When creating my method interceptor class, the namespaces appear and the autocomplete works:

enter image description here

As soon as I try to build the solution and run it on the emulator, it fails gives me these errors:

enter image description here

And then in my class, it says that "The type or namespace 'MethodBoundaryAspect' could not be found", even though it was fine before I tried building the app:

enter image description here

Where have I gone wrong here? I'm open to using other open source method interceptors.

jarrad_obrien
  • 391
  • 1
  • 4
  • 15

1 Answers1

2

This seems to be a bug in the weaver. We had the same issue in our project (albeit not Xamarin, but WPF with CPS) and resolved it with the workaround from the linked issue:

Open your csproj file and change the package import from

<PackageReference Include="MethodBoundaryAspect.Fody" Version="1.0.66">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>

to just

<PackageReference Include="MethodBoundaryAspect.Fody" Version="1.0.66" />
Lennart
  • 9,657
  • 16
  • 68
  • 84
  • That was it! Note that I had to delete those lines from the corresponding `.Android`, `.iOS`, and `.UWP` `.csproj` files as well – jarrad_obrien Nov 01 '18 at 14:38