Method not found: 'Nancy.ErrorPipeline Nancy.ErrorPipeline.op_Addition

We updated Nancy from v1.2.0 to 1.3.0 via NuGet. According to the changelog there appear to be no breaking changes relevant to our application. However we are now getting the runtime error

Method not found: 'Nancy.ErrorPipeline Nancy.ErrorPipeline.op_Addition(Nancy.ErrorPipeline, System.Func`3)'.

in

base.ApplicationStartup(container, pipelines);

in our CustomBootstrapper. We are using Nancy.Bootstrappers.Autofac and have a custom IStatusCodeHandler.

I have cleaned out the packages folder, as well as bin/obj folders, and verified that there is only one version of Nancy after package restore.

How can I resolve or troubleshoot this?

Jon Skeet
people
quotationmark

(Caveat: I've never used Nancy. This is just a matter of looking at the history in Github.)

It looks like the + operator signature you're using changed from this in 1.2.0:

public static ErrorPipeline operator +
    (ErrorPipeline pipeline, Func<NancyContext, Exception, Response> func)

to this in 1.3.0:

public static ErrorPipeline operator +
    (ErrorPipeline pipeline, Func<NancyContext, Exception, dynamic> func)

That's not a backwardly-compatible change, at the very least at the binary level. As far as the CLR is concerned, that signature will be

public static ErrorPipeline operator +
    (ErrorPipeline pipeline, Func<NancyContext, Exception, object> func)

... so any binary with a reference to the earlier signature won't find what it's looking for.

Do any of your dependencies also depend on Nancy, possibly at v1.2.0? Basically, you need to find out which piece of code is expecting the old signature, so you can rebuild that code against 1.3.0.

people

See more on this question at Stackoverflow