Re: [Mono-list] Extension method not found

2010-09-01 Thread Dr_Asik

Ok thanks, adding System.Core in projectB fixed it. It worked without it with
VS2010 though.

Btw I was using a project reference not an assembly reference.
-- 
View this message in context: 
http://mono.1490590.n4.nabble.com/Extension-method-not-found-tp2402574p2403419.html
Sent from the Mono - General mailing list archive at Nabble.com.
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Extension method not found

2010-09-01 Thread Krogerma
Hello, Mr. Prawdi, hello list.
 
We have the same problem. We are side-stepping the assembly right now,  
because we have others to get running under Mono. I had planned to boil it down 
 to a small piece of code and submit this to the list.
 
Same deal as yours - a whole bunch of extension methods work fine, but  
there's just one that the linker can't seem to find.
 
Works fine on Windows-Mono, but fails on Linux-Mono (Suse). Windows-Mono is 
 built with MonoDevelop. Reflector reveals that the code looks fine.
 
I'll be tracking progress on this eagerly. I'll report anything I find out  
when I get back to look at this. Please keep me advised if you find out  
anything.
 
Cheers!
 
Kurt Matis
Troy, NY
 
 
 
 
 
In a message dated 8/31/2010 11:39:51 P.M. Eastern Daylight Time,  
blask_pra...@yahoo.ca writes:


Hello,

I am having a weird problem with Mono. I have a  solution made of 2 projects
A and B, targeting Mono/.NET 3.5. In project A,  I have a class called
BinaryExtensions which define a bunch of extensions  methods for
System.IO.BinaryReader and BinaryWriter. Both projects A and B  use some of
these extensions methods; project B references project A for  that reason.
For some reason, project B fails to find one of the extensions  methods when
compiling.

The whole thing works perfectly fine under  VS2010. Using Monodevelop 2.4
under Ubuntu 10.04 to compile my code,  however, I get CS1061 (Type
'System.IO.BinayReader' does not contain a  definition for funcX and no
extension method could be found). The thing is,  the method in question is
used successfully by project A. Project B also  successfully uses other
extensions methods from BinaryExtensions. But it  fails to find one
particular function. Here is the code for that  function:

public static string  ReadNullTerminatedASCIIString(this BinaryReader
binaryReader, int count)  {
var rawBytes =  binaryReader.ReadBytes(count);
rawBytes = rawBytes.TakeWhile(b = b != 0x00).ToArray();
var chars =  Encoding.ASCII.GetChars(rawBytes);
return new string(chars);
}

Again, this function is used by projectA and projectA compiles fine.  Also,
other extension methods of that class are used by projectB and  generate no
errors.

Also, when I use the assembly browser to check  projectA, all extensions
methods decompile fine except for the method in  question. I get:

Decompilation  failed:

System.NotImplementedException: IL_0011: ldftn  bool
AssetImporter.BinaryExtensions::m__0(System.Byte)
at  Cecil.Decompiler.Cil.BaseInstructionVisitor.OnLdftn
(Mono.Cecil.Cil.Instruction  instruction) [0x0] in :0 
at  Cecil.Decompiler.Cil.InstructionDispatcher.Dispatch
(Mono.Cecil.Cil.Instruction  instruction, IInstructionVisitor visitor)
[0x0] in :0 
at  Cecil.Decompiler.Cil.BaseInstructionVisitor.Visit
(Mono.Cecil.Cil.Instruction  instruction) [0x0] in :0 
at  Cecil.Decompiler.StatementDecompiler.ProcessExpressionBlock
(Cecil.Decompiler.Cil.InstructionBlock  block, Boolean skip_first) [0x0]
in :0 
at  Cecil.Decompiler.StatementDecompiler.ProcessExpressionBlock
(Cecil.Decompiler.Cil.InstructionBlock  block) [0x0] in :0 
at  Cecil.Decompiler.StatementDecompiler.PushConditionExpression
(Mono.Cecil.Cil.Instruction  instruction) [0x0] in :0 
at  Cecil.Decompiler.StatementDecompiler.TryProcessExpression
(Mono.Cecil.Cil.Instruction  instruction) [0x0] in :0 
at  Cecil.Decompiler.StatementDecompiler.ProcessInstruction
(Mono.Cecil.Cil.Instruction  instruction) [0x0] in :0 
at  Cecil.Decompiler.StatementDecompiler.ProcessInstructions
(Cecil.Decompiler.Cil.InstructionBlock  block) [0x0] in :0 
at  Cecil.Decompiler.StatementDecompiler.ProcessBlock
(Cecil.Decompiler.Cil.InstructionBlock  block) [0x0] in :0 
at  Cecil.Decompiler.StatementDecompiler.ProcessBlocks () [0x0] in :0  
at Cecil.Decompiler.StatementDecompiler.Run () [0x0] in :0  
at  Cecil.Decompiler.StatementDecompiler.Process
(Cecil.Decompiler.DecompilationContext  context,
Cecil.Decompiler.Ast.BlockStatement body) [0x0] in :0  
at Cecil.Decompiler.DecompilationPipeline.Run  (Mono.Cecil.Cil.MethodBody
body) [0x0] in :0 
at  Cecil.Decompiler.Extensions.RunPipeline
(Cecil.Decompiler.DecompilationPipeline  pipeline, Mono.Cecil.Cil.MethodBody
body) [0x0] in :0 
at  Cecil.Decompiler.Extensions.Decompile (Mono.Cecil.Cil.MethodBody  body,
ILanguage language) [0x0] in :0 
at  Cecil.Decompiler.Languages.CSharpWriter.Write
(Mono.Cecil.MethodDefinition  method) [0x0] in :0 
at  MonoDevelop.AssemblyBrowser.DomMethodNodeBuilder.Decompile
(MonoDevelop.Projects.Dom.DomCecilMethod  method, Boolean markup) [0x0]
in :0 

What's going on?
--  
View this message in context:  
http://mono.1490590.n4.nabble.com/Extension-method-not-found-tp2402574p2402574.html
Sent  from the Mono - General mailing list archive at  Nabble.com.
___
Mono-list  maillist  -   Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Extension method not found

2010-08-31 Thread Dr_Asik

Hello,

I am having a weird problem with Mono. I have a solution made of 2 projects
A and B, targeting Mono/.NET 3.5. In project A, I have a class called
BinaryExtensions which define a bunch of extensions methods for
System.IO.BinaryReader and BinaryWriter. Both projects A and B use some of
these extensions methods; project B references project A for that reason.
For some reason, project B fails to find one of the extensions methods when
compiling.

The whole thing works perfectly fine under VS2010. Using Monodevelop 2.4
under Ubuntu 10.04 to compile my code, however, I get CS1061 (Type
'System.IO.BinayReader' does not contain a definition for funcX and no
extension method could be found). The thing is, the method in question is
used successfully by project A. Project B also successfully uses other
extensions methods from BinaryExtensions. But it fails to find one
particular function. Here is the code for that function:

public static string ReadNullTerminatedASCIIString(this BinaryReader
binaryReader, int count) {
var rawBytes = binaryReader.ReadBytes(count);
rawBytes = rawBytes.TakeWhile(b = b != 0x00).ToArray();
var chars = Encoding.ASCII.GetChars(rawBytes);
return new string(chars);
}

Again, this function is used by projectA and projectA compiles fine. Also,
other extension methods of that class are used by projectB and generate no
errors.

Also, when I use the assembly browser to check projectA, all extensions
methods decompile fine except for the method in question. I get:

Decompilation failed:

System.NotImplementedException: IL_0011: ldftn bool
AssetImporter.BinaryExtensions::m__0(System.Byte)
  at Cecil.Decompiler.Cil.BaseInstructionVisitor.OnLdftn
(Mono.Cecil.Cil.Instruction instruction) [0x0] in :0 
  at Cecil.Decompiler.Cil.InstructionDispatcher.Dispatch
(Mono.Cecil.Cil.Instruction instruction, IInstructionVisitor visitor)
[0x0] in :0 
  at Cecil.Decompiler.Cil.BaseInstructionVisitor.Visit
(Mono.Cecil.Cil.Instruction instruction) [0x0] in :0 
  at Cecil.Decompiler.StatementDecompiler.ProcessExpressionBlock
(Cecil.Decompiler.Cil.InstructionBlock block, Boolean skip_first) [0x0]
in :0 
  at Cecil.Decompiler.StatementDecompiler.ProcessExpressionBlock
(Cecil.Decompiler.Cil.InstructionBlock block) [0x0] in :0 
  at Cecil.Decompiler.StatementDecompiler.PushConditionExpression
(Mono.Cecil.Cil.Instruction instruction) [0x0] in :0 
  at Cecil.Decompiler.StatementDecompiler.TryProcessExpression
(Mono.Cecil.Cil.Instruction instruction) [0x0] in :0 
  at Cecil.Decompiler.StatementDecompiler.ProcessInstruction
(Mono.Cecil.Cil.Instruction instruction) [0x0] in :0 
  at Cecil.Decompiler.StatementDecompiler.ProcessInstructions
(Cecil.Decompiler.Cil.InstructionBlock block) [0x0] in :0 
  at Cecil.Decompiler.StatementDecompiler.ProcessBlock
(Cecil.Decompiler.Cil.InstructionBlock block) [0x0] in :0 
  at Cecil.Decompiler.StatementDecompiler.ProcessBlocks () [0x0] in :0 
  at Cecil.Decompiler.StatementDecompiler.Run () [0x0] in :0 
  at Cecil.Decompiler.StatementDecompiler.Process
(Cecil.Decompiler.DecompilationContext context,
Cecil.Decompiler.Ast.BlockStatement body) [0x0] in :0 
  at Cecil.Decompiler.DecompilationPipeline.Run (Mono.Cecil.Cil.MethodBody
body) [0x0] in :0 
  at Cecil.Decompiler.Extensions.RunPipeline
(Cecil.Decompiler.DecompilationPipeline pipeline, Mono.Cecil.Cil.MethodBody
body) [0x0] in :0 
  at Cecil.Decompiler.Extensions.Decompile (Mono.Cecil.Cil.MethodBody body,
ILanguage language) [0x0] in :0 
  at Cecil.Decompiler.Languages.CSharpWriter.Write
(Mono.Cecil.MethodDefinition method) [0x0] in :0 
  at MonoDevelop.AssemblyBrowser.DomMethodNodeBuilder.Decompile
(MonoDevelop.Projects.Dom.DomCecilMethod method, Boolean markup) [0x0]
in :0 

What's going on?
-- 
View this message in context: 
http://mono.1490590.n4.nabble.com/Extension-method-not-found-tp2402574p2402574.html
Sent from the Mono - General mailing list archive at Nabble.com.
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Extension method not found

2010-08-31 Thread Dr_Asik

I want to correct something I just said. ProjectB did not use any other
extension methods. I tried using another one and got the same error. So I am
unable to use any extension method from ProjectA in ProjectB (although
ProjectA uses them without issues). However, the decompilation error only
happens with the method I listed; other extension methods decompile fine.
-- 
View this message in context: 
http://mono.1490590.n4.nabble.com/Extension-method-not-found-tp2402574p2402578.html
Sent from the Mono - General mailing list archive at Nabble.com.
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Extension method not found

2010-08-31 Thread Christopher David Howie
On 08/31/2010 11:49 PM, Dr_Asik wrote:
 I want to correct something I just said. ProjectB did not use any 
 other extension methods. I tried using another one and got the same 
 error. So I am unable to use any extension method from ProjectA in
 ProjectB (although ProjectA uses them without issues). However, the 
 decompilation error only happens with the method I listed; other 
 extension methods decompile fine.

Does ProjectB use *any* extension methods?  If so, do they work?

If not, check if ProjectB references System.Core.  If it does not then
this may be the cause of your compilation errors, since the attribute
that designates a method as an extension method is declared in
System.Core.  (The this syntax for declaring extension methods is
actually just syntactic sugar for the application of this attribute.)

If you can compile under VS without referencing System.Core then this
could be considered a Mono bug.

And, as a final note, if this doesn't work, or if you are already
referencing System.Core, then try to create a solution that reproduces
the problem with minimal code.  It's a bit hard to assist without having
something we can tinker with and try to fix.

-- 
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers

If you correspond with me on a regular basis, please read this document:
http://www.chrishowie.com/email-preferences/

PGP fingerprint: 2B7A B280 8B12 21CC 260A DF65 6FCE 505A CF83 38F5


IMPORTANT INFORMATION/DISCLAIMER

This document should be read only by those persons to whom it is
addressed.  If you have received this message it was obviously addressed
to you and therefore you can read it.

Additionally, by sending an email to ANY of my addresses or to ANY
mailing lists to which I am subscribed, whether intentionally or
accidentally, you are agreeing that I am the intended recipient, and
that I may do whatever I wish with the contents of any message received
from you, unless a pre-existing agreement prohibits me from so doing.

This overrides any disclaimer or statement of confidentiality that may
be included on your message.
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Extension method not found

2010-08-31 Thread Michael Hutchinson
On Tue, Aug 31, 2010 at 11:39 PM, Dr_Asik blask_pra...@yahoo.ca wrote:
 Also, when I use the assembly browser to check projectA, all extensions
 methods decompile fine except for the method in question. I get:

 Decompilation failed:

 System.NotImplementedException: IL_0011: ldftn bool
 AssetImporter.BinaryExtensions::m__0(System.Byte)
  at Cecil.Decompiler.Cil.BaseInstructionVisitor.OnLdftn
 (Mono.Cecil.Cil.Instruction instruction) [0x0] in :0
  at Cecil.Decompiler.Cil.InstructionDispatcher.Dispatch
 (Mono.Cecil.Cil.Instruction instruction, IInstructionVisitor visitor)
 [0x0] in :0
  at Cecil.Decompiler.Cil.BaseInstructionVisitor.Visit
 (Mono.Cecil.Cil.Instruction instruction) [0x0] in :0
  at Cecil.Decompiler.StatementDecompiler.ProcessExpressionBlock
 (Cecil.Decompiler.Cil.InstructionBlock block, Boolean skip_first) [0x0]
 in :0
  at Cecil.Decompiler.StatementDecompiler.ProcessExpressionBlock
 (Cecil.Decompiler.Cil.InstructionBlock block) [0x0] in :0
  at Cecil.Decompiler.StatementDecompiler.PushConditionExpression
 (Mono.Cecil.Cil.Instruction instruction) [0x0] in :0
  at Cecil.Decompiler.StatementDecompiler.TryProcessExpression
 (Mono.Cecil.Cil.Instruction instruction) [0x0] in :0
  at Cecil.Decompiler.StatementDecompiler.ProcessInstruction
 (Mono.Cecil.Cil.Instruction instruction) [0x0] in :0
  at Cecil.Decompiler.StatementDecompiler.ProcessInstructions
 (Cecil.Decompiler.Cil.InstructionBlock block) [0x0] in :0
  at Cecil.Decompiler.StatementDecompiler.ProcessBlock
 (Cecil.Decompiler.Cil.InstructionBlock block) [0x0] in :0
  at Cecil.Decompiler.StatementDecompiler.ProcessBlocks () [0x0] in :0
  at Cecil.Decompiler.StatementDecompiler.Run () [0x0] in :0
  at Cecil.Decompiler.StatementDecompiler.Process
 (Cecil.Decompiler.DecompilationContext context,
 Cecil.Decompiler.Ast.BlockStatement body) [0x0] in :0
  at Cecil.Decompiler.DecompilationPipeline.Run (Mono.Cecil.Cil.MethodBody
 body) [0x0] in :0
  at Cecil.Decompiler.Extensions.RunPipeline
 (Cecil.Decompiler.DecompilationPipeline pipeline, Mono.Cecil.Cil.MethodBody
 body) [0x0] in :0
  at Cecil.Decompiler.Extensions.Decompile (Mono.Cecil.Cil.MethodBody body,
 ILanguage language) [0x0] in :0
  at Cecil.Decompiler.Languages.CSharpWriter.Write
 (Mono.Cecil.MethodDefinition method) [0x0] in :0
  at MonoDevelop.AssemblyBrowser.DomMethodNodeBuilder.Decompile
 (MonoDevelop.Projects.Dom.DomCecilMethod method, Boolean markup) [0x0]
 in :0

 What's going on?

I don't know about your main problem, but this particular trace is
completely unrelated. It's just a limitation in MonoDevelop's C#
decompiler. BTW, I'd suggest you use a project reference, not an
assembly reference.

-- 
Michael Hutchinson
http://mjhutchinson.com
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list