Search code examples
c#tfsmailchimpservicestack-text

SerializationException on one machine and not on another


I am using Visual Studio 2013 and TFS for a project. My colleague and I have machines with Windows 8.1 and Windows 8 respectively, both pointing to same database. Both machines have latest .NET framework installed.

Till now all was fine, until I added nuget package MailChimp.NET, It also have dependency on ServiceStack.Text. It threw below error on just my machine for any mailchimp API calls

Type definitions should start with a '{', expecting serialized type 'ApiError', got string starting with: <HTML>

<HEAD>

<meta http-equiv="Content-Type" co

I tried same on my collegues machine and all works fine. Even if I copy paste whole solution to my local machine and run, there is same serializationException.

This is where only my machine throws error

at ServiceStack.Text.Common.DeserializeTypeRefJson.StringToType(Type type, String strType, EmptyCtorDelegate ctorFn, Dictionary`2 typeAccessorMap)

Anything I am missing due to which this error occurs?


Solution

  • Problem was not due to different windows or .NET version but due to proxy used in the organization. The dll of mailchimp uses WebRequest which did not bring any json as proxy was not added, and thus error on deserialization.

    Add proxy settings to web.config as below and the problem is solved.

    <system.net>
        <defaultProxy>
            <proxy bypassonlocal="True" proxyaddress="http://youraddress:port" />
        </defaultProxy>
    </system.net>