2017-02-22 1 views
0

정말 이상한 문제가 있습니다. 모든 최신 PowerBI의 nuget-패키지와 나는 다음과 같은 예외가 종속의 최신 반복으로 :PowerBIClient는 특정 상황에서 System.ArrayTypeMismatchException을 생성합니다.

Exception thrown: 'System.ArrayTypeMismatchException' in mscorlib.dll 

Additional information: Attempted to access an element as a type incompatible with the array. 

스택 추적은 저에게이 보여줍니다

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 

PowerBIClient 소스 코드를 조사하는 중에

/// </summary> 
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<JsonConverter> 
      { 
       new Iso8601TimeSpanConverter() 
      } 
    }; 
    DeserializationSettings = new JsonSerializerSettings 
    { 
     DateFormatHandling = DateFormatHandling.IsoDateFormat, 
     DateTimeZoneHandling = DateTimeZoneHandling.Utc, 
     NullValueHandling = NullValueHandling.Ignore, 
     ReferenceLoopHandling = ReferenceLoopHandling.Serialize, 
     ContractResolver = new ReadOnlyJsonContractResolver(), 
     Converters = new List<JsonConverter> 
      { 
       new Iso8601TimeSpanConverter() 
      } 
    }; 
    CustomInitialize(); 
} 

것은 내가 figu 수 없습니다 나는 그것이 JsonConvert 목록에 형 Iso8601TimeSpanConverter의 클래스를 추가하는 시도를하지, 여기 봐 가지고 초기화에 발견 몇 가지 버전이 포함 된 데모 샘플에서 내 응용 프로그램에서이 문제가 발생하는 이유를 확인하고 완전히 작동합니다. 그러나 4.6.1에서 처음으로 일반 .NET 콘솔 앱을 사용했을 때도 작동하도록했습니다. 하지만 이제는 .NET 4.6.1 프레임 워크를 사용하는 .NET Core 콘솔 앱을 사용하고 있습니다. 이 모든 것은 잘 작동합니다.

는 여기에 문제의 스크린 샷입니다 :

Screenshot of the issue

내가 PowerBI 관련 동안 다시는 아니지만 비슷한 문제로이 개발자를 발견했다. 그러나 대답은 없습니다.

Adding Iso8601TimeSpanConverter to JsonConverter list throws ArrayTypeMismatch exception

답변

0

지금 제공하는 문제에 대한 링크는이 문제를 해결하기 위해 나에게 도움이 힌트가 포함되어 있습니다. 제 경우에는 GAC에 설치된 Newtonsoft.Json.dll의 여러 버전으로 인해 발생했습니다. 라이브러리 참조를 최신 버전으로 해결하기 위해 앱을 구성한 후에 예외가 사라졌습니다.

관련 문제