Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #87 #91

Merged
merged 2 commits into from
Jun 20, 2015
Merged

Fix for issue #87 #91

merged 2 commits into from
Jun 20, 2015

Conversation

fknx
Copy link
Contributor

@fknx fknx commented Jun 9, 2015

I have added an if statement which checks whether the parameter type is a decimal or decimal? before SetConstantis called. I also added two simple test cases where an Interface and Class proxy is created for an Interface (or Class) containing methods with all kinds of optional parameters.

…d parameter of type decimal or decimal? causes an exception).
* A decimal value may not be passed to SetConstant(), so omit the call
* in this instance.
*
* See https://github.com/castleproject/Core/issues/87 and https://bit.ly/1eXx6fF
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know the background on the issue, but it'd be nicer if the comment was a bit clearer that this is a defect/omission in .NET so in the future when the .NET defect is fixed someone can remove this code without worry in case our GitHub issues history isn't around anymore.

Could you also include the full URL for the MSDN link rather than a bit.ly link:
https://msdn.microsoft.com/en-au/library/system.reflection.emit.parameterbuilder.setconstant(v=vs.110).aspx

@jonorossi
Copy link
Member

Looks good, thanks. Did you try compiling this with .NET 3.5 because I suspect it'll fail because optional parameters weren't supported then?

MSBuild /p:Configuration=NET35-Release buildscripts/Build.proj

You'll likely need to wrap the new code in an #if !NET35.

- Changed comment to clarify that the fix is necessary because of a shortcoming of the .NET Framework.
- Added compiler flags to make sure the new tests (and classes & interfaces) are only included in case the .NET Framework version is not set to 3.5.
@fknx
Copy link
Contributor Author

fknx commented Jun 17, 2015

I was able to compile the code using Visual Studio even with the NET35 configurations, but according to this link this may not work using a command-line compiler, so I have wrapped the test code in an #if !DOTNET35.

Additionally, I modified the comment as you suggested.

@jonorossi
Copy link
Member

@fknx thanks

jonorossi added a commit that referenced this pull request Jun 20, 2015
@jonorossi jonorossi merged commit 75e348e into castleproject:master Jun 20, 2015
jonorossi added a commit that referenced this pull request Jun 20, 2015
@jonorossi
Copy link
Member

The Silverlight builds failed in the same way the .NET 3.5 one would have, but don't worry I've fixed them in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants