Bug 19922 - Different debugger ObjectId when loading and unloading assembly
Summary: Different debugger ObjectId when loading and unloading assembly
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Zoltan Varga
Depends on:
Reported: 2014-05-20 07:52 UTC by David Karlaš
Modified: 2014-05-20 21:59 UTC (History)
2 users (show)

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

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:

Description David Karlaš 2014-05-20 07:52:20 UTC
MonoDevelop has list of assemblyFilters which is sent to Runtime on every step so runtime steps only into user code. When any assembly is loaded in runtime event EVENT_KIND_ASSEMBLY_LOAD is called to MD and that assembly is added into assemblyFilters if name matches userAssemblies... Problem is that when EVENT_KIND_ASSEMBLY_UNLOAD is called it has different ObjectId then when it was called for EVENT_KIND_ASSEMBLY_LOAD which results in unloaded assembly staying in assemblyFilter list. So on next step that assembly is sent into runtime and then runtime detects that assembly is unloaded and respons with "ERR_UNLOADED" error. Below is sample to reproduce this:

using System;
class Program
  static void Main (string[] args)
    AppDomain newDomain = AppDomain.CreateDomain ("NewApplicationDomain");
    newDomain.ExecuteAssembly (@"/path/to/some/monoConsoleApp.exe"");
    AppDomain.Unload (newDomain);
    Console.WriteLine ("Breakpoint here and step");
    Console.WriteLine ("Never make to this line because error: ERR_UNLOADED, id=7, type=0");
Comment 1 Zoltan Varga 2014-05-20 14:25:01 UTC
I can't reproduce this. Does this happen with vs or with xs ?
Comment 2 Zoltan Varga 2014-05-20 21:59:50 UTC
Fixed in mono master f29c547b659c03126989622302dd664e0a29983f.