私は、プロジェクトで参照されているサードパーティのDLLの数を使用するC#コンソールアプリケーションで作業していました。例外サードパーティのDLLにアクセスするときに呼び出しのターゲットによってスローされる
すべてがうまくいっていたが、ある日私のWindows 7オペレーティングシステムは自動ウィンドウ更新のために更新され、その後、このアプリケーションコードは実際にデータベースにアクセスするサードパーティのDLLに呼び出されるコードでクラッシュし始めた。
私のシステムを以前の状態に戻したところ、アプリケーションは正常に動作し始めましたが、再びウィンドウの更新が実行され、アプリケーションは同じ場所で再びクラッシュし始めました。
私は会社の提供するラップトップとしてWindowsの更新を停止することはできません。また、Windowsの更新が再び発生しないように設定を変更することはできません。私はこのサードパーティのDLLのコードを持っていません。私はあなたにここのapp.configを提供することができます
...
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
<section name="databaseSection" type="Cognizant.CAFE.FoundationServices.Data.Configuration.DatabaseSection,Cognizant.CAFE.FoundationServices.Data"/>
<section name="cafe.frameworks.foundationAbstraction" type="Cognizant.CAFE.Frameworks.FoundationAbstraction.Adapters.Configuration.FoundationAbstractionSectionHandler, Cognizant.CAFE.Frameworks.FoundationAbstraction.AdapterFactory"/>
<section name="loggingConfiguration" type="Cognizant.CAFE.FoundationServices.Logging.Configuration.LoggingConfigurationSection, Cognizant.CAFE.FoundationServices.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
<section name="exceptionManagement" type="Cognizant.CAFE.FoundationServices.ExceptionManagement.Configuration.ExceptionManagementSection, Cognizant.CAFE.FoundationServices.ExceptionManagement, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</configSections>
<!--<databaseSection performanceCountersEnabled="false" />
<exceptionManagement performanceCountersEnabled="false" />-->
<databaseSection defaultDatabase="Sql" dbCommandTimeOut="3000">
<databases>
<add name="Sql" type="Cognizant.CAFE.FoundationServices.Data.SqlHelper,Cognizant.CAFE.FoundationServices.Data" connectionStringName="Sql"/>
</databases>
</databaseSection>
<log4net>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="C:\ApplicationLogs\BGTs\AA\v1.0\AABackgroundTask\Files\Log\AABLog.txt"/>
<appendToFile value="true"/>
<maximumFileSize value="1500KB"/>
<maxSizeRollBackups value="20"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%d [%t] %-5p %c - %m%n"/>
</layout>
</appender>
<root>
<level value="DEBUG"/>
<appender-ref ref="RollingFile"/>
</root>
</log4net>
<connectionStrings>
-----deleted
</connectionStrings>
<appSettings>
<!--Production-->
<!-- PROCESS DELAY SECTION -->
<add key="ProcessDelay" value="0"/>
<!-- INBOUND -->
<add key="IB_GlobalVarCreation" value="GlobalVarCreation"/>
<add key="IB_RoutingScript_In" value="RoutingScript_In"/>
<!-- OUTBOUND -->
<add key="OB_CampaignCreation" value="CampaignCreation"/>
<add key="OB_RoutingScript_Out" value="RoutingScript_Out"/>
<add key="OB_AdminScript_Agent" value="AdminScript_Agent"/>
<add key="OB_DisableCampaign" value=" DisableCampaign"/>
<!-- INBOUND & OUTBOUND -->
<add key="IB_OB_EnterpriseSkillGroup" value="EnterpriseSkillGroup"/>
<add key="IB_OB_SkillGroupCreation" value="SkillGroupCreation"/>
<add key="IB_OB_EnterpriseSkillGroupMap" value="EnterpriseSkillGroupMap"/>
<add key="IB_OB_CallType" value="CallType"/>
<add key="IB_OB_DialNumberMapping" value="DialNumberMapping"/>
<!--NORAML OPERATIONS-->
<add key="OPS_UserCreation" value="UserCreation"/>
<add key="OPS_AgentSupervisor" value="AgentSupervisor"/>
<add key="OPS_Rehire" value="Rehire"/>
<add key="OPS_AgentTeamCreation" value="AgentTeamCreation"/>
<add key="OPS_AgentSkillGroup" value="AgentSkillGroup"/>
<add key="OPS_AgentTeam" value="AgentTeam"/>
<add key="OPS_SupervisorTeam" value="SupervisorTeam"/>
<add key="OPS_AgentTeamUpdate" value="AgentTeamUpdate"/>
<!--Active Directory INFORMATION -->
<add key="adURL" value="IQOR.QOR.COM"/>
<add key="adUser" value="IQOR\ERP.IQ.QATCH"/>
<add key="adPassword" value="+loS96bB8jNKv1JWXVLb0w=="/>
<!--Others-->
<add key="OTH_TeamUpdateEnable" value="true"/>
<add key="OTH_ProgarmPoolIndEnable" value="false"/>
</appSettings>
<cafe.frameworks.foundationAbstraction>
<authorization>
<adapters>
<add name="CafeProvider" type="Cognizant.CAFE.Frameworks.FoundationAbstraction.Adapters.CAFE.AuthorizationAdapter, Cognizant.CAFE.Frameworks.FoundationAbstraction.Adapters.CAFE, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" default="True"/>
<add name="EnterpriseLibraryProvider" type="Cognizant.CAFE.Frameworks.FoundationAbstraction.Adapters.EnterpriseLibrary.AuthorizationAdapter, Cognizant.CAFE.Frameworks.FoundationAbstraction.Adapters.EnterpriseLibrary, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</adapters>
</authorization>
<caching>
<adapters>
<add name="EnterpriseLibraryProvider" type="Cognizant.CAFE.Frameworks.FoundationAbstraction.Adapters.EnterpriseLibrary.CacheAdapter, Cognizant.CAFE.Frameworks.FoundationAbstraction.Adapters.EnterpriseLibrary, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" default="True"/>
</adapters>
</caching>
<dataAccess>
<adapters>
<add name="CafeProvider" type="Cognizant.CAFE.Frameworks.FoundationAbstraction.Adapters.CAFE.DataAccessAdapter, Cognizant.CAFE.Frameworks.FoundationAbstraction.Adapters.CAFE, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" default="True"/>
</adapters>
</dataAccess>
<exceptionManagement>
<adapters>
<add name="CafeProvider" type="Cognizant.CAFE.Frameworks.FoundationAbstraction.Adapters.CAFE.ExceptionManagerAdapter, Cognizant.CAFE.Frameworks.FoundationAbstraction.Adapters.CAFE, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" default="True"/>
<add name="EnterpriseLibraryProvider" type="Cognizant.CAFE.Frameworks.FoundationAbstraction.Adapters.EnterpriseLibrary.ExceptionManagerAdapter, Cognizant.CAFE.Frameworks.FoundationAbstraction.Adapters.EnterpriseLibrary, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</adapters>
</exceptionManagement>
<logging>
<adapters>
<add name="CafeProvider" type="Cognizant.CAFE.Frameworks.FoundationAbstraction.Adapters.CAFE.LoggingAdapter, Cognizant.CAFE.Frameworks.FoundationAbstraction.Adapters.CAFE, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" default="True"/>
<add name="EnterpriseLibraryProvider" type="Cognizant.CAFE.Frameworks.FoundationAbstraction.Adapters.EnterpriseLibrary.LoggingAdapter, Cognizant.CAFE.Frameworks.FoundationAbstraction.Adapters.EnterpriseLibrary, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</adapters>
</logging>
</cafe.frameworks.foundationAbstraction>
<loggingConfiguration>
<commonSettings loggingEnabled="true" logToTrace="true" useAdditionalParameters="true">
<loggingMode asynchronous="False"/>
<filters>
<allowedLogLevels>
<add name="Error"/>
<add name="Fatal"/>
<add name="Information"/>
<add name="Trace"/>
<add name="Warning"/>
</allowedLogLevels>
<allowedLogCategories>
<add name="Category"/>
</allowedLogCategories>
</filters>
<publishers>
<add name="DBLog" type="Cognizant.CAFE.FoundationServices.Logging.DBPublisher, Cognizant.CAFE.FoundationServices.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
<add name="EventLog" type="Cognizant.CAFE.FoundationServices.Logging.EventLogPublisher, Cognizant.CAFE.FoundationServices.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
<add name="MSMQLog" type="Cognizant.CAFE.FoundationServices.Logging.MSMQPublisher, Cognizant.CAFE.FoundationServices.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
<add name="TextLog" type="Cognizant.CAFE.FoundationServices.Logging.TextFilePublisher, Cognizant.CAFE.FoundationServices.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
<add name="XMLLog" type="Cognizant.CAFE.FoundationServices.Logging.XMLFilePublisher, Cognizant.CAFE.FoundationServices.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</publishers>
<formatters defaultFormatter="Text">
<add name="Text" type="Cognizant.CAFE.FoundationServices.Logging.TextFormatter, Cognizant.CAFE.FoundationServices.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
<add name="Xml" type="Cognizant.CAFE.FoundationServices.Logging.XMLFormatter, Cognizant.CAFE.FoundationServices.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</formatters>
</commonSettings>
<logSettings defaultCategory="Category">
<categories>
<add categoryName="Category">
<categorySettings>
<add levelName="Error">
<sinks>
<add publisherName="TextLog" formatterName="Text" fileName="AABLog.txt" maxFileSize="1MB"/>
</sinks>
</add>
</categorySettings>
</add>
</categories>
</logSettings>
</loggingConfiguration>
<exceptionManagement>
<policies defaultPolicy="UI Policy">
<add name="UI Policy" type="">
<exceptions>
<add name="Exception" type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="None">
<handlers>
<add name="Log Handler" type="Cognizant.CAFE.FoundationServices.ExceptionManagement.LogHandler, Cognizant.CAFE.FoundationServices.ExceptionManagement, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</handlers>
</add>
</exceptions>
</add>
</policies>
<messageSources defaultSource="Xml">
<add name="Xml" type="Cognizant.CAFE.FoundationServices.ExceptionManagement.XmlMessageSource, Cognizant.CAFE.FoundationServices.ExceptionManagement, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" source="D:\Cognizant\CAFE.NET 2.0\Foundation Services\QuickStart\Web\ExceptionMessages.xml"/>
</messageSources>
</exceptionManagement>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri=""/>
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400"/>
</providers>
</roleManager>
</system.web>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
私のアプリケーションが例外をクラッシュしたり与えているコードは以下の通りです:
ここpublic DataSet GetData(string statementId, string parameter)
{
object[] param = null;
DataSet ds = null;
try
{
if (parameter != null)
{
param = new object[1];
param[0] = parameter;
ds = DataAccessFaçadeAdapter.ExecuteStatementForDataSet(statementId, param);
}
else
{
ds = ExecuteStoredProcedure(statementId);
}
}
catch (Exception ex)
{
Tracer.Trace(TraceLevel.Error, "GetData() Exception is" + ex.Message);
}
return ds;
}
どこ次の行がありますこのメソッドは、コードがないサードパーティ製のDLLで書かれているため、例外が発生する
ds = DataAccessFaçadeAdapter.ExecuteStatementForDataSet(statementId, param);
と例外の詳細は以下の通りです:
- InnerException {"Object reference not set to an instance of an object."} System.Exception {System.NullReferenceException}
Message "Object reference not set to an instance of an object." string
スタックトレース以下のように:サードパーティDLLのスタックトレースは以下の通りです
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at Cognizant.CAFE.Frameworks.FoundationAbstraction.AdapterFactory.GetAdapter[T]()
at IQOR.QATCH.IntegrationServices.DataAccessFaçadeAdapter.ExecuteStatementForDataSet(String StatementID, Object[] parameters)
at IQOR.AA.BackgroundTask.Exporter.GetData(String statementId, String parameter) in C:\\AutomationAnywhere_OLD_CODE\\AutomationAnywhere_OLD\\IQOR.AA.BackgroundTask - Copy\\IQOR.AA.BackgroundTask\\Exporter.cs:line 433
:
at Cognizant.CAFE.FoundationServices.Data.AdoHelperFactory.GetConnectionString(String providerName)
at Cognizant.CAFE.FoundationServices.Data.AdoHelperFactory.CreateHelper(String providerName)
at Cognizant.CAFE.FoundationServices.Data.AdoHelperFactory.CreateHelper()
at Cognizant.CAFE.Frameworks.FoundationAbstraction.Adapters.CAFE.DataAccessAdapter..ctor()
方法について教えてください解決する。
どのバージョンの.Netをターゲットにしていますか? – OmegaMan
私は.Netバージョン3.5をターゲットにしています –
例外の詳細を示す画像も追加しました。私が直面している問題を理解するためには、ある程度役立つかもしれません。 –