[Mono-list] Extension method not found
Krogerma at aol.com
Krogerma at aol.com
Wed Sep 1 16:46:50 EDT 2010
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_prawdi at 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) [0x00000] in :0
at Cecil.Decompiler.Cil.InstructionDispatcher.Dispatch
(Mono.Cecil.Cil.Instruction instruction, IInstructionVisitor visitor)
[0x00000] in :0
at Cecil.Decompiler.Cil.BaseInstructionVisitor.Visit
(Mono.Cecil.Cil.Instruction instruction) [0x00000] in :0
at Cecil.Decompiler.StatementDecompiler.ProcessExpressionBlock
(Cecil.Decompiler.Cil.InstructionBlock block, Boolean skip_first) [0x00000]
in :0
at Cecil.Decompiler.StatementDecompiler.ProcessExpressionBlock
(Cecil.Decompiler.Cil.InstructionBlock block) [0x00000] in :0
at Cecil.Decompiler.StatementDecompiler.PushConditionExpression
(Mono.Cecil.Cil.Instruction instruction) [0x00000] in :0
at Cecil.Decompiler.StatementDecompiler.TryProcessExpression
(Mono.Cecil.Cil.Instruction instruction) [0x00000] in :0
at Cecil.Decompiler.StatementDecompiler.ProcessInstruction
(Mono.Cecil.Cil.Instruction instruction) [0x00000] in :0
at Cecil.Decompiler.StatementDecompiler.ProcessInstructions
(Cecil.Decompiler.Cil.InstructionBlock block) [0x00000] in :0
at Cecil.Decompiler.StatementDecompiler.ProcessBlock
(Cecil.Decompiler.Cil.InstructionBlock block) [0x00000] in :0
at Cecil.Decompiler.StatementDecompiler.ProcessBlocks () [0x00000] in :0
at Cecil.Decompiler.StatementDecompiler.Run () [0x00000] in :0
at Cecil.Decompiler.StatementDecompiler.Process
(Cecil.Decompiler.DecompilationContext context,
Cecil.Decompiler.Ast.BlockStatement body) [0x00000] in :0
at Cecil.Decompiler.DecompilationPipeline.Run (Mono.Cecil.Cil.MethodBody
body) [0x00000] in :0
at Cecil.Decompiler.Extensions.RunPipeline
(Cecil.Decompiler.DecompilationPipeline pipeline, Mono.Cecil.Cil.MethodBody
body) [0x00000] in :0
at Cecil.Decompiler.Extensions.Decompile (Mono.Cecil.Cil.MethodBody body,
ILanguage language) [0x00000] in :0
at Cecil.Decompiler.Languages.CSharpWriter.Write
(Mono.Cecil.MethodDefinition method) [0x00000] in :0
at MonoDevelop.AssemblyBrowser.DomMethodNodeBuilder.Decompile
(MonoDevelop.Projects.Dom.DomCecilMethod method, Boolean markup) [0x00000]
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 at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20100901/b76d7b90/attachment.html
More information about the Mono-list
mailing list