You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
builder.AppendLine(" throw new global::System.InvalidOperationException(\"Unable to assign 'null' to the property or field of type '"+memberTypeName+"'.\");");
4322
+
builder.Append(indent).AppendLine(" throw new global::System.InvalidOperationException(\"Unable to assign 'null' to the property or field of type '"+memberTypeName+"'.\");");
4293
4323
}
4294
4324
4295
-
builder.AppendLine(" }");
4296
-
builder.AppendLine(" else");
4297
-
builder.AppendLine(" {");
4298
-
builder.Append(" var memberConverter = reader.GetConverter(typeof(").Append(memberTypeName).AppendLine("));");
4299
-
builder.Append(" var canPopulateMember = memberConverter.CanPopulate(typeof(").Append(memberTypeName).Append("))");
4325
+
builder.Append(indent).AppendLine("}");
4326
+
builder.Append(indent).AppendLine("else");
4327
+
builder.Append(indent).AppendLine("{");
4328
+
builder.Append(indent).Append(" var memberConverter = reader.GetConverter(typeof(").Append(memberTypeName).AppendLine("));");
4300
4329
if(!canPopulateValueType)
4301
4330
{
4302
-
builder.Append(" && false");
4303
-
}
4304
-
4305
-
builder.AppendLine(";");
4306
-
builder.AppendLine(" if (!canPopulateMember)");
4307
-
builder.AppendLine(" {");
4308
-
if(explicitPopulate)
4309
-
{
4310
-
if(member.Type.IsValueType&&!canAssign)
4331
+
if(explicitPopulate)
4311
4332
{
4312
-
builder.Append(" throw new global::System.InvalidOperationException(\"Property '").Append(member.Symbol.Name)
4333
+
builder.Append(indent).Append(" throw new global::System.InvalidOperationException(\"Property '").Append(member.Symbol.Name)
4313
4334
.Append("' on type '").Append(declaringTypeName)
4314
4335
.AppendLine("' is marked with JsonObjectCreationHandling.Populate but is a value type that doesn't have a setter.\");");
4315
4336
}
4316
4337
else
4317
4338
{
4318
-
builder.Append(" throw new global::System.InvalidOperationException(\"Property '").Append(member.Symbol.Name)
4319
-
.Append("' on type '").Append(declaringTypeName)
4320
-
.AppendLine("' is marked with JsonObjectCreationHandling.Populate but it doesn't support populating. This can be either because the property type is immutable or it could use a custom converter.\");");
builder.Append(indent).Append(" var canPopulateMember = memberConverter.CanPopulate(typeof(").Append(memberTypeName).AppendLine("));");
4347
+
builder.Append(indent).AppendLine(" if (!canPopulateMember)");
4348
+
builder.Append(indent).AppendLine(" {");
4349
+
if(explicitPopulate)
4350
+
{
4351
+
builder.Append(indent).Append(" throw new global::System.InvalidOperationException(\"Property '").Append(member.Symbol.Name)
4352
+
.Append("' on type '").Append(declaringTypeName)
4353
+
.AppendLine("' is marked with JsonObjectCreationHandling.Populate but it doesn't support populating. This can be either because the property type is immutable or it could use a custom converter.\");");
0 commit comments