Bug 881 - Decompilation failed in Assembly Browser: System.ArgumentOutOfRangeException
Summary: Decompilation failed in Assembly Browser: System.ArgumentOutOfRangeException
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Assembly browser ()
Version: 2.6
Hardware: PC Windows
: Low normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2011-09-18 02:17 UTC by Stas Kalashnikov
Modified: 2012-02-23 02:12 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Screenshot of Assembly Browser with exception (73.79 KB, image/png)
2011-09-18 02:17 UTC, Stas Kalashnikov

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Stas Kalashnikov 2011-09-18 02:17:28 UTC
Created attachment 415 [details]
Screenshot of Assembly Browser with exception

When I select System.Array.CreateInstance (Type, int) in Assembly Browser, there is an exception info in the window where should be a source code (see the sceenshot):

Decompilation failed: 
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
   at Mono.Collections.Generic.Collection`1.get_Item(Int32 index)
   at Cecil.Decompiler.ExpressionDecompiler.PushArgumentReference(Int32 index)
   at Cecil.Decompiler.ExpressionDecompiler.OnLdarga(Instruction instruction)
   at Cecil.Decompiler.Cil.InstructionDispatcher.Dispatch(Instruction instruction, IInstructionVisitor visitor)
   at Cecil.Decompiler.Cil.BaseInstructionVisitor.Visit(Instruction instruction)
   at Cecil.Decompiler.StatementDecompiler.ProcessInstruction(Instruction instruction)
   at Cecil.Decompiler.StatementDecompiler.ProcessInstructions(InstructionBlock block)
   at Cecil.Decompiler.StatementDecompiler.ProcessBlock(InstructionBlock block)
   at Cecil.Decompiler.StatementDecompiler.ProcessBlocks()
   at Cecil.Decompiler.StatementDecompiler.Run()
   at Cecil.Decompiler.StatementDecompiler.Process(DecompilationContext context, BlockStatement body)
   at Cecil.Decompiler.DecompilationPipeline.Run(MethodBody body)
   at Cecil.Decompiler.Extensions.RunPipeline(DecompilationPipeline pipeline, MethodBody body)
   at Cecil.Decompiler.Extensions.Decompile(MethodBody body, ILanguage language)
   at Cecil.Decompiler.Languages.CSharpWriter.Write(MethodDefinition method)
   at MonoDevelop.AssemblyBrowser.DomMethodNodeBuilder.Decompile(DomCecilMethod method, Boolean markup)
Comment 1 Stas Kalashnikov 2011-10-27 03:56:47 UTC
Select DataSet in the editor, press F12 and get the following exception (shown in the window where should be signatures of the DataSet's members):

Decompilation failed: 
System.InvalidOperationException: Failed to resolve type: System.ComponentModel.DesignerSerializationVisibility
   в Mono.Cecil.Mixin.CheckedResolve(TypeReference self)
   в Mono.Cecil.SignatureReader.ReadCustomAttributeEnum(TypeReference enum_type)
   в Mono.Cecil.SignatureReader.ReadCustomAttributeElementValue(TypeReference type)
   в Mono.Cecil.SignatureReader.ReadCustomAttributeElement(TypeReference type)
   в Mono.Cecil.SignatureReader.ReadCustomAttributeFixedArgument(TypeReference type)
   в Mono.Cecil.SignatureReader.ReadCustomAttributeConstructorArguments(CustomAttribute attribute, Collection`1 parameters)
   в Mono.Cecil.MetadataReader.ReadCustomAttributeSignature(CustomAttribute attribute)
   в Mono.Cecil.CustomAttribute.<Resolve>b__2(CustomAttribute attribute, MetadataReader reader)
   в Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
   в Mono.Cecil.CustomAttribute.Resolve()
   в Mono.Cecil.CustomAttribute.get_HasConstructorArguments()
   в ICSharpCode.Decompiler.Ast.AstBuilder.ConvertCustomAttributes(AstNode attributedNode, ICustomAttributeProvider customAttributeProvider, String attributeTarget)
   в ICSharpCode.Decompiler.Ast.AstBuilder.CreateProperty(PropertyDefinition propDef)
   в ICSharpCode.Decompiler.Ast.AstBuilder.AddTypeMembers(TypeDeclaration astType, TypeDefinition typeDef)
   в ICSharpCode.Decompiler.Ast.AstBuilder.CreateType(TypeDefinition typeDef)
   в ICSharpCode.Decompiler.Ast.AstBuilder.AddType(TypeDefinition typeDef)
   в MonoDevelop.AssemblyBrowser.DomTypeNodeBuilder.<>c__DisplayClass11.<Decompile>b__10(AstBuilder b)
   в MonoDevelop.AssemblyBrowser.DomMethodNodeBuilder.Decompile(TextEditorData data, ModuleDefinition module, TypeDefinition currentType, Action`1 setData)
Comment 2 Stas Kalashnikov 2011-10-27 04:01:13 UTC
Last bug with DataSet is in MonoDevelop 2.8.1 (Windows 7).

There is already no bug with System.Array.CreateInstance in 2.8.1. Assembly Browser shows correct method signature:

using System;
using System.Security;
[SecuritySafeCritical ]
public static Array CreateInstance (Type elementType, int length)
Comment 3 Mike Krüger 2012-02-23 02:12:05 UTC
Cecil decompiler is no longer be used.