{"action":"created","issue":{"url":"https://api.github.com/repos/ms-iot/BusProviders/issues/32","repository_url":"https://api.github.com/repos/ms-iot/BusProviders","labels_url":"https://api.github.com/repos/ms-iot/BusProviders/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/ms-iot/BusProviders/issues/32/comments","events_url":"https://api.github.com/repos/ms-iot/BusProviders/issues/32/events","html_url":"https://github.com/ms-iot/BusProviders/issues/32","id":140434343,"number":32,"title":"Lightning provider allows only one instance of I2cDevice","user":{"login":"NameOfTheDragon","id":1268490,"avatar_url":"https://avatars.githubusercontent.com/u/1268490?v=3","gravatar_id":"","url":"https://api.github.com/users/NameOfTheDragon","html_url":"https://github.com/NameOfTheDragon","followers_url":"https://api.github.com/users/NameOfTheDragon/followers","following_url":"https://api.github.com/users/NameOfTheDragon/following{/other_user}","gists_url":"https://api.github.com/users/NameOfTheDragon/gists{/gist_id}","starred_url":"https://api.github.com/users/NameOfTheDragon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NameOfTheDragon/subscriptions","organizations_url":"https://api.github.com/users/NameOfTheDragon/orgs","repos_url":"https://api.github.com/users/NameOfTheDragon/repos","events_url":"https://api.github.com/users/NameOfTheDragon/events{/privacy}","received_events_url":"https://api.github.com/users/NameOfTheDragon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2016-03-13T01:22:17Z","updated_at":"2016-06-02T15:48:56Z","closed_at":null,"body":"When using the lightning provider, as soon as I try to create a second instance of I2cDevice, I get the following error:\r\n\r\n> The program '[0xA34] backgroundTaskHost.exe' has exited with code -1073741189 (0xc000027b).\r\n\r\nThis is at variance with the inbox provider, which works as expected.\r\n\r\nUnfortunately this means that the lightning provider prevents communication with more than one I2C device, unless all other instances are disposed and re-created every time they are used. This is no good at all!\r\n\r\nThe problem can be reproduced using the following complete UWP Background Application, which works with the inbox provider but fails with the lightning provider:\r\n\r\n```\r\nusing System;\r\nusing System.Threading.Tasks;\r\nusing Windows.ApplicationModel.Background;\r\nusing Windows.Devices;\r\nusing Windows.Devices.I2c;\r\nusing Microsoft.IoT.Lightning.Providers;\r\n\r\n// The Background Application template is documented at http://go.microsoft.com/fwlink/?LinkID=533884&clcid=0x409\r\n\r\nnamespace I2cConcurrencyTest\r\n    {\r\n    public sealed class StartupTask : IBackgroundTask\r\n        {\r\n        public void Run(IBackgroundTaskInstance taskInstance)\r\n            {\r\n            if (LightningProvider.IsLightningEnabled)\r\n                {\r\n                // Set Lightning as the default provider\r\n                LowLevelDevicesController.DefaultProvider = LightningProvider.GetAggregateProvider();\r\n                }\r\n\r\n            var controller = I2cController.GetDefaultAsync().AsTask().WaitFoResult();\r\n            var device1Settings = new I2cConnectionSettings(0x50);\r\n            var device1 = controller.GetDevice(device1Settings);\r\n            var device2Settings = new I2cConnectionSettings(0x60);\r\n            var device2 = controller.GetDevice(device2Settings);\r\n            }\r\n        }\r\n\r\n    public static class TaskExtensions\r\n        {\r\n        internal static TResult WaitFoResult<TResult>(this Task<TResult> asyncOperation)\r\n            {\r\n            asyncOperation.Wait();\r\n            return asyncOperation.Result;\r\n            }\r\n        }\r\n    }\r\n```"},"comment":{"url":"https://api.github.com/repos/ms-iot/BusProviders/issues/comments/223334256","html_url":"https://github.com/ms-iot/BusProviders/issues/32#issuecomment-223334256","issue_url":"https://api.github.com/repos/ms-iot/BusProviders/issues/32","id":223334256,"user":{"login":"NameOfTheDragon","id":1268490,"avatar_url":"https://avatars.githubusercontent.com/u/1268490?v=3","gravatar_id":"","url":"https://api.github.com/users/NameOfTheDragon","html_url":"https://github.com/NameOfTheDragon","followers_url":"https://api.github.com/users/NameOfTheDragon/followers","following_url":"https://api.github.com/users/NameOfTheDragon/following{/other_user}","gists_url":"https://api.github.com/users/NameOfTheDragon/gists{/gist_id}","starred_url":"https://api.github.com/users/NameOfTheDragon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NameOfTheDragon/subscriptions","organizations_url":"https://api.github.com/users/NameOfTheDragon/orgs","repos_url":"https://api.github.com/users/NameOfTheDragon/repos","events_url":"https://api.github.com/users/NameOfTheDragon/events{/privacy}","received_events_url":"https://api.github.com/users/NameOfTheDragon/received_events","type":"User","site_admin":false},"created_at":"2016-06-02T15:48:56Z","updated_at":"2016-06-02T15:48:56Z","body":"I'm not able to verify this because the last two Insider builds are very unstable on my Pi3. The penultimate build is unable to shut down or restart correctly. The latest build works on first boot but fails on subsequent boots until the SD card is reimaged. Any idea how I report this?"}}
{"actor":{"display_login":"NameOfTheDragon"}}