{"action":"created","issue":{"url":"https://api.github.com/repos/moq/moq4/issues/623","repository_url":"https://api.github.com/repos/moq/moq4","labels_url":"https://api.github.com/repos/moq/moq4/issues/623/labels{/name}","comments_url":"https://api.github.com/repos/moq/moq4/issues/623/comments","events_url":"https://api.github.com/repos/moq/moq4/issues/623/events","html_url":"https://github.com/moq/moq4/issues/623","id":329961740,"node_id":"MDU6SXNzdWUzMjk5NjE3NDA=","number":623,"title":"Upgrade to Castle Core 4.3.0","user":{"login":"stakx","id":104481,"node_id":"MDQ6VXNlcjEwNDQ4MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/104481?v=4","gravatar_id":"","url":"https://api.github.com/users/stakx","html_url":"https://github.com/stakx","followers_url":"https://api.github.com/users/stakx/followers","following_url":"https://api.github.com/users/stakx/following{/other_user}","gists_url":"https://api.github.com/users/stakx/gists{/gist_id}","starred_url":"https://api.github.com/users/stakx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stakx/subscriptions","organizations_url":"https://api.github.com/users/stakx/orgs","repos_url":"https://api.github.com/users/stakx/repos","events_url":"https://api.github.com/users/stakx/events{/privacy}","received_events_url":"https://api.github.com/users/stakx/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2018-06-06T17:25:46Z","updated_at":"2018-06-14T10:11:09Z","closed_at":"2018-06-09T13:40:30Z","author_association":"MEMBER","body":"Castle Core 4.3.0 has been published earlier today (see  https://github.com/castleproject/Core/issues/354#issuecomment-395108192). Moq should upgrade its dependency because that'll enable:\r\n\r\n* support for `in` parameter modifiers on .NET Core\r\n* better reproduction of default parameter values in mock types"},"comment":{"url":"https://api.github.com/repos/moq/moq4/issues/comments/397244035","html_url":"https://github.com/moq/moq4/issues/623#issuecomment-397244035","issue_url":"https://api.github.com/repos/moq/moq4/issues/623","id":397244035,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NzI0NDAzNQ==","user":{"login":"stakx","id":104481,"node_id":"MDQ6VXNlcjEwNDQ4MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/104481?v=4","gravatar_id":"","url":"https://api.github.com/users/stakx","html_url":"https://github.com/stakx","followers_url":"https://api.github.com/users/stakx/followers","following_url":"https://api.github.com/users/stakx/following{/other_user}","gists_url":"https://api.github.com/users/stakx/gists{/gist_id}","starred_url":"https://api.github.com/users/stakx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stakx/subscriptions","organizations_url":"https://api.github.com/users/stakx/orgs","repos_url":"https://api.github.com/users/stakx/repos","events_url":"https://api.github.com/users/stakx/events{/privacy}","received_events_url":"https://api.github.com/users/stakx/received_events","type":"User","site_admin":false},"created_at":"2018-06-14T10:11:09Z","updated_at":"2018-06-14T10:11:09Z","author_association":"MEMBER","body":"@zplan - It's pretty involved, but I'll try to summarise. Basically, in IL metadata, there are two mechanisms that can be used to record an optional parameter's default value.\r\n\r\n* Record an entry in the Metadata constant table (see [ECMA-335](https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-335.pdf), section II.22.9) and link that entry to the optional parameter. This works only for primitive / built-in types because you cannot encode arbitrary objects in metadata. It's important to note here that the specification does not require that recorded constant value has the same type as the parameter it's linked to! \r\n\r\n* Attaching a custom attribute to the parameter that holds the default value. This is done for `System.DateTime` and `System.Decimal` because they are not primitive types.\r\n\r\nSystem.Reflection and System.Reflection.Emit tries to hide that distinction from you, but does a pretty poor job. When you query `ParameterInfo.[Raw]DefaultValue`, the default value might originate in a custom attribute, or in the Metadata table. When you call `ParameterBuilder.SetConstant`, however, you're targeting the Metadata table exclusively.\r\n\r\nReflection also converts values automatically to the right target type, but only in some instances. In others, querying the default value will give you the value as recorded, and you can observe that it doesn't match the actual parameter type.\r\n\r\nSo basically, Reflection is pretty broken in that regard. DynamicProxy tries hard to work around all the limitations in Reflection, which have been documented and even reported to the Mono & CLR team recently.\r\n\r\nWhat must be going wrong in your case is that there's a metadata entry of IL type `int32` for your parameter which has type `int64`. Both the reflector tool as well as VS IntelliSense / Roslyn are smart enough to simply coerce the recorded default value from `int32` to `int64`. But reflection and DynamicProxy aren't. I'm about to change the latter limitation.\r\n\r\nIf you want to know more, I'd like to direct you to this section of code&mdash;read on from there:\r\n\r\nhttps://github.com/castleproject/Core/blob/8012a37e1aa74b3aeda729c4f895c71fdae085f2/src/Castle.Core/DynamicProxy/Generators/Emitters/MethodEmitter.cs#L164-L177"}}
{"actor":{"display_login":"stakx"}}