lithnet / googleapps-managementagent

Google Workspace Management Agent for MIM 2016
MIT License
12 stars 4 forks source link

Attempted to access an element as a type incompatible with the array #40

Closed briuccio closed 5 years ago

briuccio commented 5 years ago

Hello, we got some errors on import on last days, so we tried to re-create the MA from scratch and we get "unable to retrieve schema" issue. In the event viewer we can see the following:

The extensible extension returned an unsupported error. The stack trace is:

"System.ArrayTypeMismatchException: Attempted to access an element as a type incompatible with the array. at System.Collections.Generic.List1.Add(T item) at Lithnet.GoogleApps.GoogleJsonSerializer..ctor() at Lithnet.GoogleApps.SchemaRequestFactory.<>c__DisplayClass1_0.<.ctor>b__0() at Lithnet.GoogleApps.Pool1.CreateAndAddItem() at Lithnet.GoogleApps.Pool1.Take() at Lithnet.GoogleApps.BaseClientServicePool1.Take(NullValueHandling nullValueHandling) at Lithnet.GoogleApps.SchemaRequestFactory.ListSchemas(String customerID) at Lithnet.GoogleApps.MA.SchemaBuilderUsers.AddUserCustomSchema(MASchemaType type, IManagementAgentParameters config) in D:\github\lithnet\googleapps-managementagent\src\Lithnet.GoogleApps.MA\Schema\SchemaBuilderUsers.cs:line 846 at Lithnet.GoogleApps.MA.SchemaBuilderUsers.BuildBaseSchema(MASchemaType type, IManagementAgentParameters config) in D:\github\lithnet\googleapps-managementagent\src\Lithnet.GoogleApps.MA\Schema\SchemaBuilderUsers.cs:line 338 at Lithnet.GoogleApps.MA.SchemaBuilderUsers.d__2.MoveNext() in D:\github\lithnet\googleapps-managementagent\src\Lithnet.GoogleApps.MA\Schema\SchemaBuilderUsers.cs:line 27 at Lithnet.GoogleApps.MA.SchemaBuilder.GetSchema(IManagementAgentParameters config) in D:\github\lithnet\googleapps-managementagent\src\Lithnet.GoogleApps.MA\Schema\SchemaBuilder.cs:line 25 at Lithnet.GoogleApps.MA.ManagementAgent.GetSchema(KeyedCollection`2 configParameters) in D:\github\lithnet\googleapps-managementagent\src\Lithnet.GoogleApps.MA\ManagementAgent.cs:line 483 Forefront Identity Manager 4.4.1302.0"

leoerlandsson commented 5 years ago

Hi @briuccio

Thanks for reporting this issue. Could you please provide what version of the agent you are using?

It seems the exception occurs when trying to fetch custom schemas for users. Are you using any of those?

More specifically, the exception occurs in the GoogleJsonSerializer class here in the constructor:

public GoogleJsonSerializer() { JsonSerializerSettings settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; settings.Converters.Add(new RFC3339DateTimeConverter()); settings.Converters.Add(new EmptyListConverter()); settings.Converters.Add(new NotesConverter()); settings.Converters.Add(new JsonNullStringConverter()); this.newtonsoftSerializer = JsonSerializer.Create(settings); }

Do you have any Newtonsoft overrides / assembly bindings in the app.config (miisserver.config that is, or machine.config) ?

Thank you.

Best regards, Leo

ryannewington commented 5 years ago

@briuccio is this still an issue?

briuccio commented 5 years ago

no, it is not Ryan, thank you.

ryannewington commented 5 years ago

Ok thanks for getting back to me. If it happens again, the next release out next week addresses and issue that might be the cause of this.