Bug 36081 - Monodis crash processing this assembly
Summary: Monodis crash processing this assembly
Status: RESOLVED ANSWERED
Alias: None
Product: Runtime
Classification: Mono
Component: Tools ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2015-11-20 01:11 UTC by Manu
Modified: 2017-05-17 03:21 UTC (History)
6 users (show)

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


Attachments
Assembly exhibiting the monodis failure (23.00 KB, application/x-msdownload)
2015-11-20 01:11 UTC, Manu
Details


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 GitHub or Developer Community 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:
Status:
RESOLVED ANSWERED

Description Manu 2015-11-20 01:11:58 UTC
Created attachment 13909 [details]
Assembly exhibiting the monodis failure

The attached assembly causes monodis to fail with the following message:

    .method public virtual hidebysig
           instance default class [mscorlib]System.Collections.Generic.IEnumerable`1<valuetype ILCompiler.DependencyAnalysisFramework.DependencyNodeCore`1/CombinedDependencyListEntry<!DependencyContextType>> SearchDynamicDependencies (class [mscorlib]System.Collections.Generic.List`1<class ILCompiler.DependencyAnalysisFramework.DependencyNodeCore`1<!DependencyContextType>> markedNodes, int32 firstNode, !DependencyContextType context)  cil managed
    {
        // Method begins at RVA 0x211c
        // Code size 11 (0xb)
        .maxstack 1
        .locals init (
                class [mscorlib]System.Collections.Generic.IEnumerable`1<valuetype ILCompiler.DependencyAnalysisFramework.DependencyNodeCore`1/CombinedDependencyListEntry<!DependencyContextType>>     V_0)
        IL_0000:  nop
        IL_0001:  call Unhandled loader error: 5, (null) (null) Array
* Assertion: should not be reached at loader.c:298


The microsoft ildasm tool produce the following il:


 .method public hidebysig virtual instance class [System.Runtime]System.Collections.Generic.IEnumerable`1<valuetype ILCompiler.DependencyAnalysisFramework.DependencyNodeCore`1/CombinedDependencyListEntry<!DependencyContextType>> 
          SearchDynamicDependencies(class [System.Collections]System.Collections.Generic.List`1<class ILCompiler.DependencyAnalysisFramework.DependencyNodeCore`1<!DependencyContextType>> markedNodes,
                                    int32 firstNode,
                                    !DependencyContextType context) cil managed
  {
    // Code size       11 (0xb)
    .maxstack  1
    .locals init (class [System.Runtime]System.Collections.Generic.IEnumerable`1<valuetype ILCompiler.DependencyAnalysisFramework.DependencyNodeCore`1/CombinedDependencyListEntry<!DependencyContextType>> V_0)
    IL_0000:  nop
    IL_0001:  call       !!0[] [System.Runtime]System.Array::Empty<valuetype ILCompiler.DependencyAnalysisFramework.DependencyNodeCore`1/CombinedDependencyListEntry<!DependencyContextType>>()
    IL_0006:  stloc.0
    IL_0007:  br.s       IL_0009

    IL_0009:  ldloc.0
    IL_000a:  ret
  } // end of method ComputedStaticDependencyNode`1::SearchDynamicDependencies
Comment 1 João Matos 2015-12-07 16:30:42 UTC
Just tried with Mono master and I get a different assertion:

* Assertion at class.c:7339, condition `mono_error_ok (&error)' not met
Comment 2 Zoltan Varga 2015-12-07 21:21:51 UTC
We are transitioning to using ikdasm instead of monodis, so this might not need to be fixed.
Comment 3 Manu 2016-01-06 02:19:23 UTC
Actually I raised the issue because I have an assembly that I cannot use as part of my build script because it fails to load. When I looked at monodis, it was failing in the loader as well, so I figured it was the same issue. Fixing the issue in monodis would most likely fix my issue.
Comment 4 Zoltan Varga 2016-01-07 15:35:10 UTC
If you run monodis with MONO_LOG_LEVEL=debug, it prints:

Mono: The following assembly referenced from /Users/vargaz/Downloads/ILCompiler.DependencyAnalysisFramework.dll could not be loaded:
     Assembly:   System.Collections.Immutable    (assemblyref_index=2)
     Version:    1.1.37.0
     Public Key: b03f5f7f11d50a3a
The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (/Users/vargaz/Downloads/).
Comment 5 Alexander Köplinger [MSFT] 2017-05-17 03:21:32 UTC
This is pretty much "by design" since monodis needs to load the assembly references. If you put System.Collections.Immutable.dll next to the assembly it does work.

ikdasm doesn't have that limitation.