Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'

When I try and compile C# code using the “dynamic” keyword, I get the error “Missing compiler required member ‘Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create’”

I’m building using Visual Studio for Mac

I’ve googled the error and it seems that you fix it by adding the Microsoft.CSharp.dll, but this will obviously not work on Mac.

Has anyone encountered this?

I’ve come across the exact same issue in 2018.2, Not found a good solution for it yet.

We decided to not use the “dynamic” keyword for now, it doesn’t seem to be supported.

Actually, you just need to set the Api Compatibility Level to .Net 4.x in your Player Settings, if you need to use the dynamic keyword.

55 Likes

It’s About JIT and AOT compilation. I’m using WEBGL and its AOT. Meaning that it’s not supprting new type creation in the Runtime what dynamic key word is.

1 Like

just change the Api Compatibility Level to . NET 4.x and Scripting Backend IL2CPP

5 Likes

Thank your advice,it’s useful!

Thank you!!

Thank you!! I was so confused, because I already added it to unity and it still complained…

thank you!

Thanks

Can someone help ?
Unity Version is 2021.2.5f
Seting either value doesn’t solve the problem, I’m too trying to use the dynamic keyword

7856842--997321--upload_2022-1-31_16-41-48.png

In other versions of Unity I can see the .NET 4.x, but in that is not showing

10 Likes

did you by any chance find a solution?

I am using 2021.1 and it works normally I can use dynamic and .Net 4. In the newer versions the name was changed to just .NET Framework but it should work the same.

PS: Make sure to have installed new C# SDK as well separately.

3 Likes

Hello, please I’m trying to install ‘Microsoft.CSharp’ in my power shell but i get this error: (Error adding package ‘Microsoft.CSharp’ to project ‘’. The project does not support adding package references through the add package command) I’m using this command: dotnet add package Microsoft.CSharp --version 4.7.0

Hey there! I wanted to follow up with this thread to indicate that the dynamic keyword is not something that we support in Unity. It seems that it did happen to work in earlier versions of Unity. I would recommend avoiding its use if at all possible.

5 Likes

@JoshPeterson Thanks for this confirmation. Would you have recommendations for workarounds, given that this is a known incompatibility?

That is difficult to say, in general. It will depend on your specific use case.

Any thoughts on what I may be able to use here?

public dynamic SendMessage(String messageURI, String messageParams, String authCode = "")
    {
        byte[] result = this.SendMessage(messageURI, HttpUtility.ParseQueryString(messageParams), authCode);

        string utfString = Encoding.UTF8.GetString(result, 0, result.Length);
        return JsonConvert.DeserializeObject<dynamic>(utfString);
    }

    public byte[] SendMessage(String messageURI, NameValueCollection messageParams, String authCode = "")
    {
        using (WebClient client = new WebClient())
        {
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
                    | SecurityProtocolType.Tls11
                    | SecurityProtocolType.Tls12
                    | SecurityProtocolType.Ssl3;

            client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
            if(!String.IsNullOrEmpty(authCode))
                client.Headers[HttpRequestHeader.Authorization] = authCode;

            byte[] HtmlResult = client.UploadValues(messageURI, messageParams);


            return HtmlResult;
        }
    }

Which gets used like:

var returnData = this.SendMessage(MessageURI, MessageParams, this._authorization);
        if (returnData["status"].Equals(1) && returnData["message"].Equals("success"))
        {
            long.TryParse(returnData["data"]["id"].ToString(), out returnId);
        }
        return returnId;

I’m not too sure. What is the API for JsonConvert.DeserializeObject? Can its type parameter be a System.Object? That might obtain the same behavior as dynamic does.