Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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 for Bug 51294 on
GitHub or Developer Community if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Created attachment 19128 [details]
Debugging attached project approximately 1 in 5 results in EVENT_KIND_ASSEMBLY_LOAD not being sent for assembly "xunit.assert" in "pclxUnit" domain as seen in this log output: https://gist.github.com/DavidKarlas/886d4fc3ddfe22560e99c9c442dd3368#file-load-event-not-sent-L1166-L1178
How do I run this ?
Created attachment 19232 [details]
repro project 2
Best way to reproduce this is to download new attachment(repro project 2)(old one had hardcoded paths) and install XS from this link(newest C9 has workaround): https://xamarin.azureedge.net/MonoDevelop/Mac/XamarinStudio-188.8.131.521.dmg
Then open .sln inside XS and start debugging... You will have to re-run debugging multiple times until error "Debuggee returned error code ERR_UNLOADED." appears. Thats happens when runtime doesn't send ASSEMBLY_LOAD event.
Cannot open assembly '/Users/vargaz/Projects/51294/pclxUnit/packages/xunit.runner.console.2.1.0/tools/xunit.console.exe': No such file or directory.
Since running XS is annoying I created repro as Mono unit tests at https://github.com/mono/mono/tree/bug51294repro
Notice that some code is picked from another test and some API is changed from internal to public to be able to print Ids of mirror classes in unit tests, hence unit test will need to be polished before merging to master.
To reproduce checkout that branch, build mono, navigate to mcs/class/Mono.Debugger.Soft/ and execute `make && make run-test FIXTURE=DebuggerTests.MultiDomainLoad`
It will fail because exception `Debuggee returned error code ERR_UNLOADED.` this shouldn't happen because if runtime sent AssemblyLoad event .Location would be loaded while Assembly is loaded, hence no problem with fetching .Location after assembly is unloaded...
So here is whats happening:
* the runtime current only sends load/unload events when an assembly is really loaded/unload from the runtime, not from a domain.
* the testcase receives an assembly load event for appdomain-client.exe when its loaded into the first domain.
* it receives an unload event when its unloaded after the second domain is unloaded, but the AssemblyMirror object is per domain, so its Location field is not set, causing a protocol call which fails because the assembly is in a domain which is unloading.
Not sure how to fix this. Maybe make assembly loads/unloads per domain, but this will be an api break.
We had a similar issue in VSTU and we fixed it client side. What we're doing there is:
* Keep a cache of assemblies per domains
* When we get an assembly load event, we map the assembly to the domain it is loaded in (either through AssemblyMirror.Domain if the version supports it, or AssemblyMirror.GetAssemblyObject().Domain.
* We we get a domain unload event, the client considers that all assemblies in the domain will be unloaded, and we clear our cache here.
* On AssemblyUnload, if we can't get the location it means we're unloading then it means we are already in a good state.
@Zoltan this is what .NET(Visual Studio for Windows) outputs into debug window: https://gist.github.com/DavidKarlas/75bacacc31e44559a587eab215fe6cb5
So every assembly load/unload is reported. About API breaking... Are we talking about Profiler or SDB API? I think in both cases it should be OK to always report loads/unloads(we report unloads already)...
@Jb we could work around this but it's Runtime bug imo, hence I didn't fix it yet on IDE side...