[Mono-list] Extension method not found
Dr_Asik
blask_prawdi at yahoo.ca
Tue Aug 31 23:39:47 EDT 2010
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.
More information about the Mono-list
mailing list