{"action":"closed","issue":{"url":"https://api.github.com/repos/Microsoft/CodeContracts/issues/253","labels_url":"https://api.github.com/repos/Microsoft/CodeContracts/issues/253/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/CodeContracts/issues/253/comments","events_url":"https://api.github.com/repos/Microsoft/CodeContracts/issues/253/events","html_url":"https://github.com/Microsoft/CodeContracts/issues/253","id":108004794,"number":253,"title":"ARM / Win10 IoT -- crashes when code contracts added","user":{"login":"henrygab","id":740168,"avatar_url":"https://avatars.githubusercontent.com/u/740168?v=3","gravatar_id":"","url":"https://api.github.com/users/henrygab","html_url":"https://github.com/henrygab","followers_url":"https://api.github.com/users/henrygab/followers","following_url":"https://api.github.com/users/henrygab/following{/other_user}","gists_url":"https://api.github.com/users/henrygab/gists{/gist_id}","starred_url":"https://api.github.com/users/henrygab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henrygab/subscriptions","organizations_url":"https://api.github.com/users/henrygab/orgs","repos_url":"https://api.github.com/users/henrygab/repos","events_url":"https://api.github.com/users/henrygab/events{/privacy}","received_events_url":"https://api.github.com/users/henrygab/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-23T20:58:07Z","updated_at":"2015-10-17T04:13:50Z","closed_at":"2015-10-17T04:13:50Z","body":"### Questions:\r\n1. Should one expected to be able to include Code Contracts in a Windows 10 UWP application?\r\n2. Presuming yes, should one still expect them to work, where the target is Raspberry Pi 2 (running Win10 IoT)?\r\n3. Presuming they should work on Win10 IoT, is the issue below a known bug?\r\n4. Presuming it’s not a known bug, is there anything I can do to help the team track down and root-cause this issue, so it can be triaged and potentially fixed?\r\n \r\nNote: I've created a minimal example project, so I can create a GitHub depot if requested.\r\n\r\n### Issue:\r\nAdding Code Contracts to a Windows 10 UWP App (targeting Windows 10 IoT on the Raspberry Pi 2, ARM) causes application corruption / crashes [100% repro]\r\n\r\n### Steps to repro:\r\nThis may have more steps than needed.  Example source available.\r\n* Using Visual Studio 2015...\r\n* Create a simple headless, task-based app/service for IoT\r\n\t* Include at least one additional class (the target class) that is instantiated by the task\r\n\t* Have one public constructor with a first parameter being a class type, a second parameter being a struct type\r\n\t* See sample code block 1:\r\n* Load the UWP App on the RPi2 (under debugger)\r\n* Verify the app loads and runs as expected on the RPi2, including creating the class, etc.\r\n* Toss into source control for later comparison\r\n* Add some simple code contracts.\r\n    * See sample code block 2\r\n* Load the UWP App on the RPi2 (under debugger)\r\n\r\n```\r\n    // Code Block 1\r\n    using K = System.Diagnostics.CodeContracts;\r\n    using IIC = Windows.Devices.I2C;\r\n        public class TestClass {\r\n            private class _Unusable { private _Unusable(); }\r\n            private TestClass(IIC.Device device, byte v, _Unusable mustBeNull) {\r\n                if (null == device) { throw new ArgumentNullException(\"device\");\r\n                m_Device = device;\r\n            }\r\n            public TestClass(IIC.Device device)\r\n                : this(device, 0x04, (_Unusable)null) {}\r\n    }\r\n```\r\n\r\n\r\n```\r\n            // Code Block 2\r\n            K.Contracts.Requires(null == mustBeNull);\r\n            K.Contracts.Requires(null != device);\r\n            K.Contracts.Requires((0 <= v) && (7 >= v)); // yes, I know first check is always true…\r\n```\r\n\r\n\r\n### Expected Results:\r\nThe application continues to run perfectly.\r\n\r\n### Actual Results:\r\nApp starts, and runs fine until calling the class constructor that had Code Contracts added to it.\r\nAt that point, things go haywire.  No catchable exception occurs.  Often, the program simply terminates.  Twice, stepping into the constructor caused the app to appear to restart (instruction pointer corruption??).\r\n"}}