[Mono-list] Possible Bug
dinov at microsoft.com
Sat Feb 13 20:06:33 EST 2010
Rather than just looking for System.Core MonoDevelop should really look for the System.Runtime.CompilerServices.ExtensionAttribute in any of the referenced assemblies. You can define this type in your own assembly and not reference System.Core and still use extension methods. We do this in IronPython so we can run on .NET 2.0SP1 and above but compile w/ the 3.5 compiler.
From: mono-list-bounces at lists.ximian.com [mailto:mono-list-bounces at lists.ximian.com] On Behalf Of Michael Hutchinson
Sent: Saturday, February 13, 2010 3:36 PM
To: Abe Gillespie
Subject: Re: [Mono-list] Possible Bug
I guess MonoDevelop should not provide completion for extension methods when System.Core is not referenced. MD should also reference System.Core by default in new 3.5+ projects. Please file bugs. Arguably gmcs should give a better error message too, so please file a separate bug against gmcs for that.
On Feb 13, 2010 11:37 AM, "Abe Gillespie" <abe.gillespie at gmail.com<mailto:abe.gillespie at gmail.com>> wrote:
Not sure if this is a bug or just some sugar that VS.NET<http://VS.NET> does. If you
have extension methods in one assembly and then use those extension
methods in another, if you do not reference System.Core then the
compiler can't find those methods. I think the big problem is it's
hard to diagnose. MonoDevelop will happily offer code-completion for
those extension methods. However, when you compile, it fails.
Unfortunately the error info doesn't give you any sort of clue that
it's a missing System.Core reference and *NOT* a missing method.
VS.NET<http://VS.NET> will happily offer code-completion *and* compile. Example of
an error message:
Messenger.cs(34,34): Error CS1061: Type
`Dimebrain.TweetSharp.Fluent.IFluentTwitter' does not contain a
definition for `AuthenticateAs' and no extension method
`AuthenticateAs' of type `Dimebrain.TweetSharp.Fluent.IFluentTwitter'
could be found (are you missing a using directive or an assembly
reference?) (CS1061) (Infrastructure)
The last part - "are you missing a using directive [...]" - is
misleading because that makes me think I need to add a reference to
TweetSharp. But what it really needs is the System.Core reference.
Hope that's useful.
Mono-list maillist - Mono-list at lists.ximian.com<mailto:Mono-list at lists.ximian.com>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-list