- Home /
Default Parameter Specifiers Are Not Permitted
I started editing a new C# script in MonoDevelop, and pressed the "Build Project Assembly" button (F7). This caused it to now go into another C# library package I've had working for a while, and drop the following error dozens of times on function definitions with optional parameters:
Default parameter specifiers are not permitted (C50241)
The errors are only thrown in MonoDevelop. When you save it and switch to the Unity editor, it compiles and runs the code fine, as I've been using that package's scripts for weeks. I'm thus only now discovering that MonoDevelop doesn't approve, possibly because it's the first time I hit F7 on a C# file instead of JS, so I presume that it compiles all scripts of only the language of the script you're editing.
Google has it that C# only started accepting default parameter specifiers after version 4.0. So is there a discrepancy between the assembler of Unity and that of MonoDevelop, such that the former accepts post-C#-4.0 conventions and the latter doesn't?
Answer by feanix · Jan 09, 2012 at 05:55 AM
The latest version of mono supports this just fine. If you're using Mono Develop 2.8x and you're still getting this problem you might want to make sure you're actually using the .NET 4.0 compiler.
To do this change the setting in the Project options:
Indeed $$anonymous$$e was set to 3.5 by default. Good one.
Is there a way to make this change permanent? It seems to reset this sometimes :s
I can confim this. .NET 3.5's alternate to default parameters is member overloading. As far as changing it back I think Unity is doing that. You shouldn't have a problem if you build in Unity even though $$anonymous$$onoDevelop may be giving you an error.
$$anonymous$$ember Overloading - http://msdn.microsoft.com/en-us/library/vstudio/ms229029%28v=vs.100%29.aspx
True, no problems in Unity. Though it's still annoying in monodevelop. I mainly get this when using other libraries, and it's a pain to change all their default-parameter stuff to member overloading :P
Answer by BenoitFreslon · Aug 27, 2014 at 10:45 AM
It's worked for me: http://forum.unity3d.com/threads/monodevelop-problems-with-default-parameters.67867/#post-898994
Answer by Nummo · Dec 13, 2015 at 02:48 PM
To solve this problem I've installed latest .NET Mono Framework and then I have configured it as displayed on next picture.