{"action":"opened","issue":{"url":"https://api.github.com/repos/dotnet/corert/issues/5758","repository_url":"https://api.github.com/repos/dotnet/corert","labels_url":"https://api.github.com/repos/dotnet/corert/issues/5758/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corert/issues/5758/comments","events_url":"https://api.github.com/repos/dotnet/corert/issues/5758/events","html_url":"https://github.com/dotnet/corert/issues/5758","id":318880375,"number":5758,"title":"[Question] Discover types exported from referenced assembly from UWP app (.Net Native Release Build)","user":{"login":"harvinders","id":8557046,"avatar_url":"https://avatars2.githubusercontent.com/u/8557046?v=4","gravatar_id":"","url":"https://api.github.com/users/harvinders","html_url":"https://github.com/harvinders","followers_url":"https://api.github.com/users/harvinders/followers","following_url":"https://api.github.com/users/harvinders/following{/other_user}","gists_url":"https://api.github.com/users/harvinders/gists{/gist_id}","starred_url":"https://api.github.com/users/harvinders/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harvinders/subscriptions","organizations_url":"https://api.github.com/users/harvinders/orgs","repos_url":"https://api.github.com/users/harvinders/repos","events_url":"https://api.github.com/users/harvinders/events{/privacy}","received_events_url":"https://api.github.com/users/harvinders/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-30T12:56:14Z","updated_at":"2018-04-30T12:56:14Z","closed_at":null,"author_association":"NONE","body":"I have a UWP project with Unity IOC container. I would like to register all the ViewModels defined in the referenced assemblies. I am using VS 2017 15.6.7 with 16299 SDK.\r\n\r\nAs long as I know the assembly name I am able to load the types from that assembly like\r\n\r\n`var types = Assembly.Load(new AssemblyName(\"Simple\")).ExportedTypes.ToList();`\r\n\r\nHowever, if I try to dynamically load the assemblies, and then find the types, it does not work\r\n\r\n```\r\nvar files = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFilesAsync().AsTask().ConfigureAwait(false);\r\nforeach (var file in files.Where(file => file.FileType == \".dll\" ))\r\n{\r\n    try\r\n    {\r\n        types.AddRange(Assembly.Load(new AssemblyName(file.DisplayName)).ExportedTypes);\r\n    }\r\n    catch (Exception ex) {}\r\n}\r\n``` \r\n\r\nThe code above returns two files one is the `App.dll` and second is `clrcompression.dll`. It does not return the referenced assembly. Some other people have also reported this too [UWP .NET Native - Iterate Through Types and Assemblies\r\n](https://stackoverflow.com/q/46460948/1139856).  It maybe that `Unity` guys have an open issue because of this too (unitycontainer/registration-by-convention#2).\r\n \r\nIs it something to do with Default.rd.xml? However, it is not clear what to do, maybe some examples would help.\r\n\r\nSo, my question is, is it possible to dynamically discover the types to do registeration by convention. If not what are the alternatives, because, otherwise it seems that we can't submit our apps to store."}}
{"actor":{"display_login":"harvinders"}}