Question

Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.Binder.Convert'

Getting this error while compiling the code from documentation. Could be due to the missing  "Microsoft.CSharp" assembly. What configuration required to fix this ?


private string CreateJson(IDataReader dataReader)
{
   var list = new List();
   var cnt = dataReader.FieldCount;
   var fields = new List();
   for (int i = 0; i < cnt; i++)
   {
       fields.Add(dataReader.GetName(i));
   }
   while (dataReader.Read())
   {
       dynamic exo = new System.Dynamic.ExpandoObject();
       foreach (var field in fields)
       {
           ((IDictionary)exo).Add(field, dataReader.GetColumnValue(field));
       }
       list.Add(exo);
   }
   return JsonConvert.SerializeObject(list);
}

 

Like 0

Like

1 comments

Hello,

 

The issue you mentioned is related to the missing compiler member 'Microsoft.CSharp'. To fix this, you need to add a reference to this library in your project. Add a reference to Microsoft.CSharp.dll.

 

You can also read the documentation that may help you:

https://stackoverflow.com/questions/49637389/missing-compiler-required-member-microsoft-csharp-runtimebinder-binder-convert

 

https://github.com/dotnet/roslyn/issues/16265

Show all comments