none
.Net 4.6.2 Console Application Installed on Windows Server 2012 R2 COM Exception RRS feed

  • Question

  • Hello,

    I have this special scenario occurring in TEST environment not repeatable in DEV. 
    This is a .net 4.6.2 console application using entity framework v6.1.3 communicating to SQL Server 2008 R2 installed on Windows Server 2012 R2.
    When this application starts communication with database like first query, it fails and gives COM Exception but after first query all subsequent queries succeeded.

    The same application installed on DEV Windows Server 2012 R2 working fine. The problem is happening only at TEST environment.

    Tech Services team says TEST environment has same set up as DEV (.net 4.6.2, Windows Server 2012 R2, MS SQL Server 2008 R2).

    Below is the first LINQ query I am running on my console app, this is the line giving COM Exception, other LINQ queries after this all giving results.

    var t = (from m in Context.memdocs
    where m.dtype.StartsWith("109") && m.ctype == null && m.instnum != null && m.spdate != null &&
    m.towid > minTowId
    select m.towid);
    if (t.Any())
    {
    Min1099TowId = t.Min();
    Log.Info("\tMinimum 1099/98 TowId = " + Min1099TowId);
    Max1099TowId = t.Max();
    Log.Info("\tMaximum 1099/98 TowId = " + Max1099TowId);
    }
    else
    {
    Min1099TowId = Convert.ToInt32(_minTowIDstr);
    Log.Info("\tMinimum 1099/98 TowId = " + Min1099TowId);
    Max1099TowId = (from x in Context.memdocs
    select x.towid).Max();
    Log.Info("\tMaximum 1099/98 TowId = " + Max1099TowId);
    }

    Below is the Exception information.
    Any help is appreciated. Thanks!!

    System.Runtime.InteropServices.COMException (0x8000FFFF): Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
    at System.Security.Policy.PEFileEvidenceFactory.GetLocationEvidence(SafePEFileHandle peFile, SecurityZone& zone, StringHandleOnStack retUrl)
    at System.Security.Policy.PEFileEvidenceFactory.GenerateLocationEvidence()
    at System.Security.Policy.PEFileEvidenceFactory.GenerateEvidence(Type evidenceType)
    at System.Security.Policy.AssemblyEvidenceFactory.GenerateEvidence(Type evidenceType)
    at System.Security.Policy.Evidence.GenerateHostEvidence(Type type, Boolean hostCanGenerate)
    at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)
    at System.Security.Policy.Evidence.GetHostEvidence(Type type, Boolean markDelayEvaluatedEvidenceUsed)
    at System.Security.Policy.AppDomainEvidenceFactory.GenerateEvidence(Type evidenceType)
    at System.Security.Policy.Evidence.GenerateHostEvidence(Type type, Boolean hostCanGenerate)
    at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)
    at System.Security.Policy.Evidence.RawEvidenceEnumerator.MoveNext()
    at System.Security.Policy.Evidence.EvidenceEnumerator.MoveNext()
    at System.Configuration.ClientConfigPaths.GetEvidenceInfo(AppDomain appDomain, String exePath, String& typeName)
    at System.Configuration.ClientConfigPaths.GetTypeAndHashSuffix(AppDomain appDomain, String exePath)
    at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig)
    at System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig)
    at System.Configuration.ClientConfigurationHost.RequireCompleteInit(IInternalConfigRecord record)
    at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
    at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
    at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
    at System.Configuration.ConfigurationManager.GetSection(String sectionName)
    at System.Xml.XmlConfiguration.XmlReaderSection.get_ProhibitDefaultUrlResolver()
    at System.Xml.Schema.Parser..ctor(SchemaType schemaType, XmlNameTable nameTable, SchemaNames schemaNames, ValidationEventHandler eventHandler)
    at System.Xml.Schema.XmlSchema.Read(XmlReader reader, ValidationEventHandler validationEventHandler)
    at System.Data.Entity.Core.SchemaObjectModel.Schema.SomSchemaSetHelper.AddXmlSchemaToSet(XmlSchemaSet schemaSet, XmlSchemaResource schemaResource, HashSet`1 schemasAlreadyAdded)
    at System.Data.Entity.Core.SchemaObjectModel.Schema.SomSchemaSetHelper.AddXmlSchemaToSet(XmlSchemaSet schemaSet, XmlSchemaResource schemaResource, HashSet`1 schemasAlreadyAdded)
    at System.Data.Entity.Core.SchemaObjectModel.Schema.SomSchemaSetHelper.ComputeSchemaSet(SchemaDataModelOption dataModel)
    at System.Data.Entity.Core.Common.Utils.Memoizer`2.<>c__DisplayClass2.<Evaluate>b__0()
    at System.Data.Entity.Core.Common.Utils.Memoizer`2.Result.GetValue()
    at System.Data.Entity.Core.Common.Utils.Memoizer`2.Evaluate(TArg arg)
    at System.Data.Entity.Core.SchemaObjectModel.Schema.CreateXmlReaderSettings()
    at System.Data.Entity.Core.SchemaObjectModel.Schema.Parse(XmlReader sourceReader, String sourceLocation)
    at System.Data.Entity.Core.SchemaObjectModel.SchemaManager.ParseAndValidate(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, SchemaDataModelOption dataModel, AttributeValueNotification providerNotification, AttributeValueNotification providerManifestTokenNotification, ProviderManifestNeeded providerManifestNeeded, IList`1& schemaCollection)
    at System.Data.Entity.Core.SchemaObjectModel.SchemaManager.ParseAndValidate(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, SchemaDataModelOption dataModel, DbProviderManifest providerManifest, IList`1& schemaCollection)
    at System.Data.Entity.Core.Metadata.Edm.EdmItemCollection.LoadItems(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, SchemaDataModelOption dataModelOption, DbProviderManifest providerManifest, ItemCollection itemCollection, Boolean throwOnError)
    at System.Data.Entity.Core.Metadata.Edm.EdmItemCollection.Init(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths, Boolean throwOnError)
    at System.Data.Entity.Core.Metadata.Edm.MetadataCache.LoadEdmItemCollection(MetadataArtifactLoader loader)
    at System.Data.Entity.Core.Metadata.Edm.MetadataCache.<>c__DisplayClass5.<GetMetadataWorkspace>b__0(String k)
    at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
    at System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetMetadataWorkspace(String cacheKey, MetadataArtifactLoader artifactLoader)
    at System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetMetadataWorkspace(DbConnectionOptions effectiveConnectionOptions)
    at System.Data.Entity.Core.EntityClient.EntityConnection.GetMetadataWorkspace()
    at System.Data.Entity.Core.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection()
    at System.Data.Entity.Core.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor, ObjectQueryExecutionPlanFactory objectQueryExecutionPlanFactory, Translator translator, ColumnMapFactory columnMapFactory)
    at System.Data.Entity.Internal.InternalConnection.CreateObjectContextFromConnectionModel()
    at System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel()
    at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
    at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
    at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
    at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
    at System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
    at System.Linq.Queryable.Where[TSource](IQueryable`1 source, Expression`1 predicate)

    Thursday, November 2, 2017 12:40 PM

All replies

  • Hi,

    Do you debug your code?

    I am afraid only error message is not enough to narrow down your issue.

    Try do debug your code step by step and then give us more information.

    Sincerely,

    Bob


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, November 3, 2017 10:34 AM