I'm starting to use Optional parameters (as I came from java and haven't ever experimented with them before) and I'm running into the following issue:
Unhandled Exception: Mono.CSharp.InternalErrorException: Internal error
at Mono.CSharp.MethodGroupExpr.IsApplicable (Mono.CSharp.ResolveContext ec, Mono.CSharp.Arguments& arguments, Int32 arg_count, System.Reflection.MethodBase& method, System.Boolean& params_expanded_form) [0x00000] in <filename unknown>:0
at Mono.CSharp.MethodGroupExpr.OverloadResolve (Mono.CSharp.ResolveContext ec, Mono.CSharp.Arguments& Arguments, Boolean may_fail, Location loc) [0x00000] in <filename unknown>:0
at Mono.CSharp.New.DoResolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x00000] in <filename unknown>:0
at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Assign.DoResolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.SimpleAssign.DoResolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x00000] in <filename unknown>:0
at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.ExpressionStatement.ResolveStatement (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.StatementExpression.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Block.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.If.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Block.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.ToplevelBlock.Resolve (Mono.CSharp.FlowBranching parent, Mono.CSharp.BlockContext rc, Mono.CSharp.ParametersCompiled ip, IMethodData md) [0x00000] in <filename unknown>:0
The code causing this issue is here:
Me = new UserAccount(
name: response["first_name"] as string,
age: DateToAge(response["birthday"] as string),
facebookID: response["id"] as string,
email: response["email"] as string,
gender: (response["gender"] as string == "male") ? 0 : 1
);
Where "response" is a Dictionary<string, object>
Dictionary<string, object> response = FacebookHelper.Deserialize(jsonString);
And the UserAccount class is here:
public class UserAccount {
public string SessionKey;
public string FacebookID;
public string Name;
public string Email;
public int Age;
public int Gender;
public GeoLocation Location;
public Texture Avatar;
public UserAccount(string name, int age, int gender, string email = "", GeoLocation location = null, string sessionKey = "", string facebookID = "", Texture avatar = null) {
Name = name;
Email = email;
Age = age;
Gender = gender;
Location = location;
SessionKey = sessionKey;
FacebookID = facebookID;
Avatar = avatar;
}
}
Could anyone point me in the correct direction of resolving this?
This is a genuine compiler error that's been there for a long time. Unity uses a fork of an old and buggy version of Mono. It happens because of named parameters. Personally, I was able to use named parameters sometimes, but in some cases it just crashed on a completely correct code. Unfortunately, the only advice I can give you is not to use named parameters with Unity Mono compiler.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.