return null;\r
\r
e = a.Expr;\r
+\r
if (e is Constant) {\r
pos_values [i] = ((Constant) e).GetValue ();\r
} else if (e is TypeOf) {\r
pos_values [i] = ((TypeOf) e).TypeArg;\r
} else {\r
- Console.WriteLine ("Foo " + e);\r
Error_AttributeArgumentNotValid ();\r
return null;\r
}\r
Error_AttributeConstructorMismatch (Location);\r
return null;\r
}\r
+\r
+ //\r
+ // Now we perform some checks on the positional args as they\r
+ // cannot be null for a constructor which expects a parameter\r
+ // of type object\r
+ //\r
+\r
+ ParameterData pd = Invocation.GetParameterData (constructor);\r
+\r
+ for (int j = 0; j < pos_arg_count; ++j) {\r
+ Argument a = (Argument) pos_args [j];\r
+ \r
+ if (a.Expr is NullLiteral && pd.ParameterType (j) == TypeManager.object_type) {\r
+ Error_AttributeArgumentNotValid ();\r
+ return null;\r
+ }\r
+ }\r
\r
PropertyInfo [] prop_info_arr = new PropertyInfo [prop_infos.Count];\r
FieldInfo [] field_info_arr = new FieldInfo [field_infos.Count];\r
(ConstructorInfo) constructor, pos_values,\r
prop_info_arr, prop_values_arr,\r
field_info_arr, field_values_arr); \r
+\r
} catch (NullReferenceException) {\r
+ // \r
+ // Don't know what to do here\r
+ //\r
Report.Warning (\r
- -23, Location,\r
- "The compiler can not encode this attribute in the Mono runtime\n" +\r
- "\tdue to a known bug in it. We know about the problem and will\n" +\r
- "\tfix it as soon as possible.");\r
+ -100, Location, "NullReferenceException while trying to create attribute. Something's wrong!");\r
} catch {\r
//\r
// Sample:\r