{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/1151","labels_url":"https://api.github.com/repos/dotnet/coreclr/issues/1151/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/1151/comments","events_url":"https://api.github.com/repos/dotnet/coreclr/issues/1151/events","html_url":"https://github.com/dotnet/coreclr/issues/1151","id":88980166,"number":1151,"title":"advapi32.dll dependency leaking in the mscorlib.dll for non-Windows systems","user":{"login":"saper","id":248374,"avatar_url":"https://avatars.githubusercontent.com/u/248374?v=3","gravatar_id":"","url":"https://api.github.com/users/saper","html_url":"https://github.com/saper","followers_url":"https://api.github.com/users/saper/followers","following_url":"https://api.github.com/users/saper/following{/other_user}","gists_url":"https://api.github.com/users/saper/gists{/gist_id}","starred_url":"https://api.github.com/users/saper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saper/subscriptions","organizations_url":"https://api.github.com/users/saper/orgs","repos_url":"https://api.github.com/users/saper/repos","events_url":"https://api.github.com/users/saper/events{/privacy}","received_events_url":"https://api.github.com/users/saper/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-17T10:34:17Z","updated_at":"2015-06-17T10:56:46Z","closed_at":null,"body":"It seems that `advapi32.dll` dependency is exposed in the [mscorlib.dll](http://dotnet-ci.cloudapp.net/job/dotnet_coreclr_windows_debug/637/Azure/processDownloadRequest/637/bin/Product/FreeBSD.x64.Debug/mscorlib.dll) built using `freebsdmscorlib` target.\r\n\r\n````\r\n$ monodis --moduleref Product/FreeBSD.x64.Debug/mscorlib.dll\r\nModuleRef Table (1..3)\r\n1: advapi32.dll\r\n2: libcoreclr\r\n3: QCall\r\n````\r\n\r\nBelow is my theory why:\r\n\r\nThis might be because of the static reference to the `System.Diagnostics.Tracing.EventProvider/WriteEventErrorCode` from `System.Diagnostics.Eventing.EventSource::ThrowEventSourceException()` method.\r\nAnd this reference keeps the private class `System.Diagnostics.Tracing.EventProvider`\r\naround along with its disposer and the `EventUnregister` from `ADVAPI32.DLL`.\r\n\r\nThis method is probably not needed at all in the case where `FEATURE_MANAGED_ETW` is not defined.\r\n\r\n@stephentoub @ericstj what do you think?"},"comment":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/comments/112753262","html_url":"https://github.com/dotnet/coreclr/issues/1151#issuecomment-112753262","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/1151","id":112753262,"user":{"login":"stephentoub","id":2642209,"avatar_url":"https://avatars.githubusercontent.com/u/2642209?v=3","gravatar_id":"","url":"https://api.github.com/users/stephentoub","html_url":"https://github.com/stephentoub","followers_url":"https://api.github.com/users/stephentoub/followers","following_url":"https://api.github.com/users/stephentoub/following{/other_user}","gists_url":"https://api.github.com/users/stephentoub/gists{/gist_id}","starred_url":"https://api.github.com/users/stephentoub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephentoub/subscriptions","organizations_url":"https://api.github.com/users/stephentoub/orgs","repos_url":"https://api.github.com/users/stephentoub/repos","events_url":"https://api.github.com/users/stephentoub/events{/privacy}","received_events_url":"https://api.github.com/users/stephentoub/received_events","type":"User","site_admin":false},"created_at":"2015-06-17T10:56:46Z","updated_at":"2015-06-17T10:56:46Z","body":"Took a quick peek and that looks like a likely culprit.  The P/Invoke should never be invoked and so shouldn't cause issues, but it'd be nice if it wasn't there.  Looks like a bit more work with the ```#if```s in the source could help, and ideally not including files like EventProvider.cs in those builds if they can be easily pulled out.  @brianrob, @davmason"}}