WWWForm.AddField maximum string length reached yields nullreference?

I’m trying to understand why writing the same generated string s to file vs .AddField - the file seems to get written but for the form, this happens: ArgumentNullException: Argument cannot be null. Parameter name: s

Is some sort of WWWForm only max string length reached for AddField? What’s going on?

(On iOS)

No. This error is actually raised by the GetBytes method of the UTF8 encoding that is used implicitly by AddField (unless you use a different encoding) and this error can only happen when the parameter is actually null. Just have a look:

public unsafe virtual byte[] GetBytes(string s)
{
    if (s == null)
    {
        throw new ArgumentNullException("s");
    }

That means whatever you did your variable doesn’t seem to be initialized at all or you somehow set it explicitly to null somewhere. We can’t help you any further from here without more information.

Where does that string come from / where and how is it generated? Have you tried logging the value? Have you tried doing a null check yourself before you pass it to AddField and print an error message if it’s null?

We can’t do the debugging for you.