<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic PowerBIClient generates System.ArrayTypeMismatchException in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/PowerBIClient-generates-System-ArrayTypeMismatchException/m-p/131009#M4500</link>
    <description>&lt;P&gt;Hey fellas!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have som really strange issue going on. With all the latest PowerBI nuget-packages and their latest iterations of dependencies I get the following exception:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Exception thrown: 'System.ArrayTypeMismatchException' in mscorlib.dll

Additional information: Attempted to access an element as a type incompatible with the array.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The stack trace shows me this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;   at System.Collections.Generic.List`1.Add(T item)
   at Microsoft.PowerBI.Api.V1.PowerBIClient.Initialize()
   at Microsoft.PowerBI.Api.V1.PowerBIClient..ctor(ServiceClientCredentials credentials, DelegatingHandler[] handlers)
   at Apps.Kinetic.Reports.Endpoint.Service.Reports.g1u0.GenerateAccessToken(String _Reference) in D:\*masked*.cs:line 575&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While trying to look into the PowerBIClient source code I found on Initialize that it does attempt to add a class of type Iso8601TimeSpanConverter&amp;nbsp;to a JsonConvert list, just have a look here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        /// &amp;lt;/summary&amp;gt;
        private void Initialize()
        {
            this.Datasets = new Datasets(this);
            this.Gateways = new Gateways(this);
            this.Imports = new Imports(this);
            this.Workspaces = new Workspaces(this);
            this.Reports = new Reports(this);
            this.BaseUri = new Uri("https://api.powerbi.com");
            SerializationSettings = new JsonSerializerSettings
            {
                Formatting = Formatting.Indented,
                DateFormatHandling = DateFormatHandling.IsoDateFormat,
                DateTimeZoneHandling = DateTimeZoneHandling.Utc,
                NullValueHandling = NullValueHandling.Ignore,
                ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
                ContractResolver = new ReadOnlyJsonContractResolver(),
                Converters = new List&amp;lt;JsonConverter&amp;gt;
                    {
                        new Iso8601TimeSpanConverter()
                    }
            };
            DeserializationSettings = new JsonSerializerSettings
            {
                DateFormatHandling = DateFormatHandling.IsoDateFormat,
                DateTimeZoneHandling = DateTimeZoneHandling.Utc,
                NullValueHandling = NullValueHandling.Ignore,
                ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
                ContractResolver = new ReadOnlyJsonContractResolver(),
                Converters = new List&amp;lt;JsonConverter&amp;gt;
                    {
                        new Iso8601TimeSpanConverter()
                    }
            };
            CustomInitialize();
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now for the love of I god I can't figure out why this is occurring in my application while in the demo sample with a few versions behind, has it fully working. But I do know that I also had it working when I at first used a regular .NET console app in 4.6.1. But now I'm using a .NET Core console app using the .NET 4.6.1 framework. Everything but this works just fine.&lt;BR /&gt;&lt;BR /&gt;Here's the screenshot of the problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/0774bc57a27375313bfbf39e212d89eda7d4f30e/687474703a2f2f6936352e74696e797069632e636f6d2f356c63666d672e706e67" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advice! Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Update: I found this fella with a similiar issue a while back but not related to PowerBI. No answer however. :(&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://stackoverflow.com/questions/39339605/adding-iso8601timespanconverter-to-jsonconverter-list-throws-arraytypemismatch-e" target="_blank"&gt;http://stackoverflow.com/questions/39339605/adding-iso8601timespanconverter-to-jsonconverter-list-throws-arraytypemismatch-e&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Feb 2017 02:11:11 GMT</pubDate>
    <dc:creator>novak</dc:creator>
    <dc:date>2017-02-22T02:11:11Z</dc:date>
    <item>
      <title>PowerBIClient generates System.ArrayTypeMismatchException</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBIClient-generates-System-ArrayTypeMismatchException/m-p/131009#M4500</link>
      <description>&lt;P&gt;Hey fellas!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have som really strange issue going on. With all the latest PowerBI nuget-packages and their latest iterations of dependencies I get the following exception:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Exception thrown: 'System.ArrayTypeMismatchException' in mscorlib.dll

Additional information: Attempted to access an element as a type incompatible with the array.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The stack trace shows me this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;   at System.Collections.Generic.List`1.Add(T item)
   at Microsoft.PowerBI.Api.V1.PowerBIClient.Initialize()
   at Microsoft.PowerBI.Api.V1.PowerBIClient..ctor(ServiceClientCredentials credentials, DelegatingHandler[] handlers)
   at Apps.Kinetic.Reports.Endpoint.Service.Reports.g1u0.GenerateAccessToken(String _Reference) in D:\*masked*.cs:line 575&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While trying to look into the PowerBIClient source code I found on Initialize that it does attempt to add a class of type Iso8601TimeSpanConverter&amp;nbsp;to a JsonConvert list, just have a look here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        /// &amp;lt;/summary&amp;gt;
        private void Initialize()
        {
            this.Datasets = new Datasets(this);
            this.Gateways = new Gateways(this);
            this.Imports = new Imports(this);
            this.Workspaces = new Workspaces(this);
            this.Reports = new Reports(this);
            this.BaseUri = new Uri("https://api.powerbi.com");
            SerializationSettings = new JsonSerializerSettings
            {
                Formatting = Formatting.Indented,
                DateFormatHandling = DateFormatHandling.IsoDateFormat,
                DateTimeZoneHandling = DateTimeZoneHandling.Utc,
                NullValueHandling = NullValueHandling.Ignore,
                ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
                ContractResolver = new ReadOnlyJsonContractResolver(),
                Converters = new List&amp;lt;JsonConverter&amp;gt;
                    {
                        new Iso8601TimeSpanConverter()
                    }
            };
            DeserializationSettings = new JsonSerializerSettings
            {
                DateFormatHandling = DateFormatHandling.IsoDateFormat,
                DateTimeZoneHandling = DateTimeZoneHandling.Utc,
                NullValueHandling = NullValueHandling.Ignore,
                ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
                ContractResolver = new ReadOnlyJsonContractResolver(),
                Converters = new List&amp;lt;JsonConverter&amp;gt;
                    {
                        new Iso8601TimeSpanConverter()
                    }
            };
            CustomInitialize();
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now for the love of I god I can't figure out why this is occurring in my application while in the demo sample with a few versions behind, has it fully working. But I do know that I also had it working when I at first used a regular .NET console app in 4.6.1. But now I'm using a .NET Core console app using the .NET 4.6.1 framework. Everything but this works just fine.&lt;BR /&gt;&lt;BR /&gt;Here's the screenshot of the problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/0774bc57a27375313bfbf39e212d89eda7d4f30e/687474703a2f2f6936352e74696e797069632e636f6d2f356c63666d672e706e67" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advice! Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Update: I found this fella with a similiar issue a while back but not related to PowerBI. No answer however. :(&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://stackoverflow.com/questions/39339605/adding-iso8601timespanconverter-to-jsonconverter-list-throws-arraytypemismatch-e" target="_blank"&gt;http://stackoverflow.com/questions/39339605/adding-iso8601timespanconverter-to-jsonconverter-list-throws-arraytypemismatch-e&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 02:11:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBIClient-generates-System-ArrayTypeMismatchException/m-p/131009#M4500</guid>
      <dc:creator>novak</dc:creator>
      <dc:date>2017-02-22T02:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBIClient generates System.ArrayTypeMismatchException</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBIClient-generates-System-ArrayTypeMismatchException/m-p/132806#M4572</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="22121" data-lia-user-login="novak" class="lia-mention lia-mention-user"&gt;novak&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Not yet reproduce that exception at this moment, and I'll research on this.&lt;/P&gt;
&lt;P&gt;Meanwhile, an &lt;A href="https://github.com/Microsoft/PowerBI-CSharp/issues/81" target="_self"&gt;issue request&lt;/A&gt; is raised in the &lt;A href="https://github.com/Microsoft/PowerBI-CSharp/blob/827c9f53c1ec7ee62cd0d6a306c347194fa2858e/sdk/PowerBI.Api/Source/PowerBIClient.cs" target="_self"&gt;github lib&lt;/A&gt;, we could wait for the author's reponse at the same time.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Feb 2017 13:01:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBIClient-generates-System-ArrayTypeMismatchException/m-p/132806#M4572</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2017-02-24T13:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBIClient generates System.ArrayTypeMismatchException</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBIClient-generates-System-ArrayTypeMismatchException/m-p/133666#M4614</link>
      <description>&lt;P&gt;I'm sorry, at this time there's no acceptable solution to this issue so I went ahead and rebuilt the whole thing using REST calls. Too bad it had to cost me loads of hours to resolve with a complete workaround.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2017 15:29:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBIClient-generates-System-ArrayTypeMismatchException/m-p/133666#M4614</guid>
      <dc:creator>novak</dc:creator>
      <dc:date>2017-02-27T15:29:56Z</dc:date>
    </item>
  </channel>
</rss>

