{"action":"created","issue":{"url":"https://api.github.com/repos/mono/debugger-libs/issues/57","labels_url":"https://api.github.com/repos/mono/debugger-libs/issues/57/labels{/name}","comments_url":"https://api.github.com/repos/mono/debugger-libs/issues/57/comments","events_url":"https://api.github.com/repos/mono/debugger-libs/issues/57/events","html_url":"https://github.com/mono/debugger-libs/issues/57","id":90030977,"number":57,"title":"Mismatch between domain reload handling in soft debugger client and agent.","user":{"login":"lukaszunity","id":7856933,"avatar_url":"https://avatars.githubusercontent.com/u/7856933?v=3","gravatar_id":"","url":"https://api.github.com/users/lukaszunity","html_url":"https://github.com/lukaszunity","followers_url":"https://api.github.com/users/lukaszunity/followers","following_url":"https://api.github.com/users/lukaszunity/following{/other_user}","gists_url":"https://api.github.com/users/lukaszunity/gists{/gist_id}","starred_url":"https://api.github.com/users/lukaszunity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukaszunity/subscriptions","organizations_url":"https://api.github.com/users/lukaszunity/orgs","repos_url":"https://api.github.com/users/lukaszunity/repos","events_url":"https://api.github.com/users/lukaszunity/events{/privacy}","received_events_url":"https://api.github.com/users/lukaszunity/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"jstedfast","id":338984,"avatar_url":"https://avatars.githubusercontent.com/u/338984?v=3","gravatar_id":"","url":"https://api.github.com/users/jstedfast","html_url":"https://github.com/jstedfast","followers_url":"https://api.github.com/users/jstedfast/followers","following_url":"https://api.github.com/users/jstedfast/following{/other_user}","gists_url":"https://api.github.com/users/jstedfast/gists{/gist_id}","starred_url":"https://api.github.com/users/jstedfast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jstedfast/subscriptions","organizations_url":"https://api.github.com/users/jstedfast/orgs","repos_url":"https://api.github.com/users/jstedfast/repos","events_url":"https://api.github.com/users/jstedfast/events{/privacy}","received_events_url":"https://api.github.com/users/jstedfast/received_events","type":"User","site_admin":false},"milestone":null,"comments":7,"created_at":"2015-06-22T07:25:15Z","updated_at":"2015-09-03T11:51:50Z","closed_at":null,"body":"I'm submitting this issue as a starting point for a discussion on how to fix a mismatch between how the soft debugger client and agent handle domain reloads.\r\n\r\nThe debugger agent registers new types (mirrors) with a type + domain pair.\r\nhttps://github.com/mono/mono/blob/master/mono/mini/debugger-agent.c#L2276\r\nand the types are marked as unloaded when a domain is unloaded.\r\nhttps://github.com/mono/mono/blob/master/mono/mini/debugger-agent.c#L2210\r\n\r\nIn the client there is a single cache for all the types across domains\r\nhttps://github.com/mono/debugger-libs/blob/master/Mono.Debugging.Soft/SoftDebuggerSession.cs#L60\r\nand the types are removed when an assembly is unloaded.\r\nhttps://github.com/mono/debugger-libs/blob/master/Mono.Debugging.Soft/SoftDebuggerSession.cs#L1879\r\n\r\nThis causes issues where the agent can unload a type associated with a domain, but if the assembly for the type is not unloaded (due to it being used in another domain), then the client will have a reference to a type that is marked as unloaded in the agent.\r\n\r\nZoltan Varga told me the following when I asked whether this was problem in the debugger agent: \"Conceptually, assemblies are loaded into each domain they are referenced, so a reference to a type is really a reference to a type+domain pair, this is how the runtime code works. I think the problem is in the debugger-libs code, which should handle this the same way as the runtime code does, i.e. keep things in domain specific caches, and invalidate those caches when a domain is unloaded, not when an assembly is unloaded.\"\r\n\r\nWould you accept PRs that address this issue and if so, do you have any suggestions for how to go about fixing it?"},"comment":{"url":"https://api.github.com/repos/mono/debugger-libs/issues/comments/137415649","html_url":"https://github.com/mono/debugger-libs/issues/57#issuecomment-137415649","issue_url":"https://api.github.com/repos/mono/debugger-libs/issues/57","id":137415649,"user":{"login":"DavidKarlas","id":774791,"avatar_url":"https://avatars.githubusercontent.com/u/774791?v=3","gravatar_id":"","url":"https://api.github.com/users/DavidKarlas","html_url":"https://github.com/DavidKarlas","followers_url":"https://api.github.com/users/DavidKarlas/followers","following_url":"https://api.github.com/users/DavidKarlas/following{/other_user}","gists_url":"https://api.github.com/users/DavidKarlas/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidKarlas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidKarlas/subscriptions","organizations_url":"https://api.github.com/users/DavidKarlas/orgs","repos_url":"https://api.github.com/users/DavidKarlas/repos","events_url":"https://api.github.com/users/DavidKarlas/events{/privacy}","received_events_url":"https://api.github.com/users/DavidKarlas/received_events","type":"User","site_admin":false},"created_at":"2015-09-03T11:51:50Z","updated_at":"2015-09-03T11:51:50Z","body":"A bit weird that domain has assemblies unloaded when event happens since it can't unload assemblies 1 by 1(I'm just saying it would make more sense to always return assemblies since returning empty doesn't mean much... but w/e)\r\n\r\nYe, imo making list of loaded assemblies into domain via assembly loaded event... and using that list to remove types looks very logical and promising..."}}