elastic / elasticsearch-net

This strongly-typed, client library enables working with Elasticsearch. It is the official client maintained and supported by Elastic.
https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/index.html
Apache License 2.0
3.57k stars 1.15k forks source link

Type Load Exception when SCOM Agent Running on Windows Server #4480

Closed thollowell closed 4 years ago

thollowell commented 4 years ago

After upgrading NEST and Elasticsearch.Net packages to 6.8.3 we are seeing the following error in app init. A few other threads have mentioned this can be traced to some type of conflict with the SCOM (System Center Operations Manger) agent which is deployed on our APP servers where we communicate with ES.

Log entry from our API servers below.

2020-03-04 11:23:04,496 [175] ERROR GetAllClustersHealthApi - Executing method resulted in unhandled exception: 'System.TypeInitializationException: The type initializer for 'Elasticsearch.Net.ConnectionConfiguration' threw an exception. ---> System.Reflection.AmbiguousMatchException: Multiple custom attributes of the same type found. at System.Attribute.GetCustomAttribute(Assembly element, Type attributeType, Boolean inherit) at Elasticsearch.Net.RuntimeInformation.get_FrameworkDescription() at Elasticsearch.Net.ConnectionConfiguration..cctor() --- End of inner exception stack trace --- at Elasticsearch.Net.ConnectionConfiguration1..ctor(IConnectionPool connectionPool, IConnection connection, IElasticsearchSerializer requestResponseSerializer) at Nest.ConnectionSettingsBase1..ctor(IConnectionPool connectionPool, IConnection connection, SourceSerializerFactory sourceSerializerFactory, IPropertyMappingProvider propertyMappingProvider) at removed.ES.ElasticClientBuilder.BuildClientCore(ClusterClientConfig clientConfig, IConnectionPool pool) at removed.ES.ClientFactory.<>c__DisplayClass7_1.b3(ClusterClientConfig cc) at System.Linq.Enumerable.WhereSelectListIterator2.MoveNext() at removed.ES.ClientFactory.LoadClients() at System.Lazy1.CreateValue() at System.Lazy`1.LazyInitValue() at removed.ES.ClientFactory.ResolveTargetCluster(ClientRequestContext context) at removed.ES.ClientFactory.GetClient(ClientRequestContext context) at removed.ES.ClusterSettingsClient.d3.MoveNext() in D:\Agent02_work\14\s\Src\removed\ES\ClusterSettingsClient.cs:line 0

Running on Windows Server 2012 R2. .Net Framework 4.7.2. SCOM Agent version is SCOM 2012 R2. NEST version 6.8.3. ES.Net version 6.8.3 ES version 6.5

to repro, try to initialize a connection settings on a machine running the SCOM Agent. Link below to another report of a similar issue which lead us to believe the SCOM agent is a potential cause for this. This does not occur on machines not running SCOM agents, however we cannot remove SCOM from our production servers.

https://github.com/okta/okta-sdk-dotnet/issues/296

Mpdreamz commented 4 years ago

A fix for this went out in: https://github.com/elastic/elasticsearch-net/releases/tag/6.8.4

Please update and try again! Please let us know if this is still an issue.

thollowell commented 4 years ago

Thanks. Will give it a shot.