Giter VIP home page Giter VIP logo

Comments (5)

lonix1 avatar lonix1 commented on July 24, 2024

Actually, I'm unsure of this.

Forgetting about the analyser for now (I just disabled it), I nonetheless get this exception;

Exception thrown: 'Castle.DynamicProxy.InvalidProxyConstructorArgumentsException' in Castle.Core.dll

Weird, those args are optional, I'd have thought this would work?

from nsubstitute.analyzers.

tpodolak avatar tpodolak commented on July 24, 2024

Hi @lonix1. As you've seen Castle.Core throws exception even though parameters are options, that is why NSubstitute.Analyzers reports warning. Perhaps we should change warning message to sth more self explanatory. @dtchepak any thoughts on that?

Weird, those args are optional, I'd have thought this would work?

I assume this is limitation of Catle.Core rather than issue with NSubstitute itself, however I dont know that much about internals of NSubstitute. @dtchepak do you maybe know if this is this known problem of Castle.Core?

from nsubstitute.analyzers.

lonix1 avatar lonix1 commented on July 24, 2024

Your idea of a more descriptive warning is good. It will let the user know that it is "normal" and there is nothing he can do about it.

from nsubstitute.analyzers.

dtchepak avatar dtchepak commented on July 24, 2024

IIRC optional arguments are injected at compile-time? In that case Castle.Core will have no way of knowing what to pass to the constructor. (see also this thread).

Does Roslyn provide access to optional param information? If so maybe that should be a new error explaining optional parameters must be passed explicitly (possibly quick fix to pass the defaults?).

from nsubstitute.analyzers.

tpodolak avatar tpodolak commented on July 24, 2024

Does Roslyn provide access to optional param information? If so maybe that should be a new error explaining optional parameters must be passed explicitly (possibly quick fix to pass the defaults?).

Yes, we can extract default values with Roslyn
image

I will try to figure out how to use it in ctor matching logic

from nsubstitute.analyzers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.