Giter Club home page Giter Club logo

Comments (8)

MatKubicki avatar MatKubicki commented on July 29, 2024

I can reproduce this and have tracked it down to a problem with the way Moq detects event handler attach methods and other special method types. The key file is:
\Source\MemberInfoExtensions.cs - in this case Line 66

Methods called 'add__' and 'remove__' will not work, this is case sensitive hence why 'Add' works. We will need to try and find a better way to detect if something is an event handler attach call.

from moq4.

kzu avatar kzu commented on July 29, 2024

Maybe we can just try to cast and fallback to considering it a regular method oherwise?

from moq4.

ashmind avatar ashmind commented on July 29, 2024

Shouldn't that be checking IsSpecialName?

from moq4.

kzu avatar kzu commented on July 29, 2024

+1 to IsSpecialName. Shouldn't pass for a normal method named "add_*"

from moq4.

F0b0s avatar F0b0s commented on July 29, 2024

Why we should restrict users in their naming style(i have a lot of legacy code and it might be painfull to change restricted names)? Can we mark all special method types with some attribute?

from moq4.

kzu avatar kzu commented on July 29, 2024

it's been so many years and this has come up so rarely that I'd say it's a
corner case which we're fine not supporting. As long as we don't throw any
exceptions, it should be fine.

I recall now that we removed the check for IsSpecialName for compatibility
with F#. See
44070a9

The naming goes against anything in .NET conventions for public/protected
members, so I think it's reasonable to assume it won't be (and hasn't been)
a serious issue for most.

/kzu

Daniel Cazzulino

On Sun, Feb 9, 2014 at 11:56 PM, F0b0s [email protected] wrote:

Why we should restrict users in their naming style(i have a lot of legacy
code and it might be painfull to change restricted names)? Can we mark all
special method types with some attribute?

Reply to this email directly or view it on GitHubhttps://github.com//issues/82#issuecomment-34600996
.

from moq4.

sreniaw avatar sreniaw commented on July 29, 2024

Aha, I was mocking a web service with add_* method names and came across this issue :)

from moq4.

stakx avatar stakx commented on July 29, 2024

Regular methods with add_ or remove_ name prefixes are now supported in Moq 4.8.0.

from moq4.

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.