I've been getting this error whenever I open a serialized file (binary) created an older version of the application (before I was working here). It looks like this:
Exception:
"Exception has been thrown by the target of an invocation." System.Reflection.TargetInvocationException
Inner expection:
InnerException {"Could not load type 'ENTRY CLASS' from assembly 'PROJECT', Version=1.0.6477.29527, Culture=neutral, PublicKeyToken=null'.":"ENTRY CLASS"} System.Exception {System.TypeLoadException}
Stack Trace:
at System.RuntimeMethodHandle.SerializationInvoke(IRuntimeMethodInfo method, Object target, SerializationInfo info, StreamingContext& context)
at System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(Object obj, SerializationInfo info, StreamingContext context)
at System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder holder)
at System.Runtime.Serialization.ObjectManager.DoFixups()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
at PACKAGE.NavigationManager.OpenSavedFile(String filePath) in C:IRL 205
at NFPA_Checker.NavigationManager.OpenFileDialog_FileOk(Object sender, CancelEventArgs e) in C:\IRL 192
at Microsoft.Win32.FileDialog.OnFileOk(CancelEventArgs e)
at Microsoft.Win32.FileDialog.HandleVistaFileOk(IFileDialog dialog)
at Microsoft.Win32.FileDialog.VistaDialogEvents.MS.Internal.AppModel.IFileDialogEvents.OnFileOk(IFileDialog pfd)
You just don't seem to get enough info from the error. How do you go about debugging an error like this?
Related
I have code in my Facade layer to make calls to active directory
activeDirectoryUserCache = new MyFacade()
.GetActiveDirectorySearchResults(MyEnum.MemberCategory.User);
This call works fine in my local machine. But when the same is deployed to DEV server, it throws the following exception.
{System.Runtime.Serialization.SerializationException: The input stream
is not a valid binary format. The starting contents (in bytes) are:
53-79-73-74-65-6D-2E-49-4F-2E-46-69-6C-65-4E-6F-74 ...
Server stack trace: at
System.Runtime.Serialization.Formatters.Binary.SerializationHeaderRecord.Read(_BinaryParser
input) at
System.Runtime.Serialization.Formatters.Binary._BinaryParser.ReadSerializationHeaderRecord()
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler
handler, __BinaryParser serParser, Boolean fCheck, Boolean
isCrossAppDomain, IMethodCallMessage methodCallMessage) at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream
serializationStream, HeaderHandler handler, Boolean fCheck, Boolean
isCrossAppDomain, IMethodCallMessage methodCallMessage) at
System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryResponseMessage(Stream
inputStream, IMethodCallMessage reqMsg, Boolean bStrictBinding) at
System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage
msg)
Exception rethrown at [0]: at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg) at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type) at
Drive.Beagle.Server.BeagleFacade.GetActiveDirectorySearchResults(MemberCategory
memberType) at
Drive.Beagle.Client.BeagleController.get_ActiveDirectoryUserCache() in
C:\Development\ MyProject\ClientCtrlr\MyController.cs:line 68}
As I understand the active directory call works with the Principal Objects and I believe they are not serializable by default and I cannot mark them as they are .net reserved objects. But what should I be doing in order to get rid of this issue?
I am using System.DirectoryServices.AccountManagement; namespace for AD Get users and groups calls.
So I get this exception from Telerik's RadGrid when using a custom DataSource but I have no idea what I am doing wrong. Any clues?
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:
System.NullReferenceException: Object reference not set to an instance
of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Telerik.Web.UI.GridResolveEnumerable.GetCollectionItemType(Boolean noItemsInEnumerator, Type& collectionItemType, Object& collectionFirstObject) +101
Telerik.Web.UI.GridResolveEnumerable.ParseProperties() +264
Telerik.Web.UI.GridResolveEnumerable.Initialize() +29
Telerik.Web.UI.GridResolveEnumerable.EnsureInitialized() +45
Telerik.Web.UI.GridResolveEnumerable.get_DataTable() +36
Telerik.Web.UI.GridEnumerableFromDataView..ctor(GridTableView owner, IEnumerable enumerable, Boolean CaseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields, Boolean enableSplitHeaderText) +245
Telerik.Web.UI.GridDataSourceHelper.CreateGridEnumerable(GridTableView owner, IEnumerable enumerable, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields, Boolean enableSplitHeaderText) +172
Telerik.Web.UI.GridDataSourceHelper.GetResolvedDataSource(GridTableView owner, Object dataSource, String dataMember, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields, Boolean enableSplitHeaderText) +322
Telerik.Web.UI.GridTableView.get_ResolvedDataSource() +257
Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +480
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +67
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +123
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +33
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +138
Telerik.Web.UI.GridTableView.PerformSelect() +38
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +30
Telerik.Web.UI.GridTableView.DataBind() +391
Telerik.Web.UI.RadGrid.DataBind() +191
Telerik.Web.UI.RadGrid.AutoDataBind(GridRebindReason rebindReason) +4251
Telerik.Web.UI.RadGrid.OnLoad(EventArgs e) +201
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
This error is happening due to some kind of (probably accidental) recursion. I'd suggest the following:
Look for something that triggers a redraw in your redraw code.
Look at your call stack when it fails and see where it is entering this endless recursion.
I am developing a library (VS 2010, assembly targeted for AnyCPU) and I am getting the following error while stepping over the constructor of XmlValidationReader(..). The parameter for this constructor is an instance of XmlReader(), and the specific XML is syntactically correct, and validates with third party tool.
Error: Catastrophic failure (Exception from HRESULT: 0x8000FFFF
(E_UNEXPECTED))
Exception object: System.Runtime.InteropServices.COMException
Stack trace:
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.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.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.ConfigurationManager.GetSection(String
sectionName) at
System.Xml.Schema.XmlSchemaCollection..ctor(XmlNameTable nametable)
at System.Xml.XmlValidatingReaderImpl..ctor(XmlReader reader) at
System.Xml.XmlValidatingReader..ctor(XmlReader reader)
I have not changed any security configuration in the system. The specific account under which the assembly is loaded has administrative privileges. Any idea of what could cause this issue? I have run through the web extensively, but in vain.
I am developing a C# WPF project with an embedded SQLite Database. I have used SQLite before without problems but for some reason when I call:
SQLiteConnection conn = new SqliteConnection("my connection string");
However, when this code executes it displays the error
XamlParserException was unhandled
Cannot create instance of MainWindow.xaml defined in assembly 'MyProject', Version=1.0.0.0...
Exception has been thrown by the target of an invocation. Error in markup file 'MainWindow.xaml' Line 1 position 9.
At this position is the following code in the XAML file
<Window xmlns:my="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit" x:Class="MySQLBackup.MainWindow"
I have set the project to be .Net Framework 3.5 so I do not understandw why I am getting this error and why it is saying it is an error in the XAML when it calls the SQLiteConnection in the class file.
Thanks for any help you can provide.
UPDATE
As requested below is the stacktrace and inner exception
Inner Exception
System.Configuration.ConfigurationErrorsException: Unrecognized
configuration section userSettings/Gui.Properties.Settings.
(C:\Users\Chris\AppData\Local\Microsoft\MySQLBackup.vshost.exe_Url_5ar2cuyxbdeg3v0bx5aak4mgjx2jmsbn\1.0.0.0\user.config
line 17) at
System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean
ignoreLocal) at
System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors
schemaErrors) at
System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors() at
System.Configuration.ClientConfigurationSystem.OnConfigRemoved(Object
sender, InternalConfigEventArgs e)
Stacktrace
at
System.Configuration.ClientConfigurationSystem.OnConfigRemoved(Object
sender, InternalConfigEventArgs e) at
System.Configuration.Internal.InternalConfigRoot.OnConfigRemoved(InternalConfigEventArgs
e) at
System.Configuration.Internal.InternalConfigRoot.RemoveConfigImpl(String
configPath, BaseConfigurationRecord configRecord) 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, Boolean getLkg, Boolean checkPermission) 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.Configuration.ClientSettingsStore.ReadSettings(String
sectionName, Boolean isUserScoped) at
System.Configuration.LocalFileSettingsProvider.GetPropertyValues(SettingsContext
context, SettingsPropertyCollection properties) at
System.Configuration.SettingsBase.GetPropertiesFromProvider(SettingsProvider
provider) at
System.Configuration.SettingsBase.GetPropertyValueByName(String
propertyName) at System.Configuration.SettingsBase.get_Item(String
propertyName) at
System.Configuration.ApplicationSettingsBase.GetPropertyValue(String
propertyName) at
System.Configuration.ApplicationSettingsBase.get_Item(String
propertyName) at
MySQLBackup.Properties.Settings.get_app_dbPassword() in
c:\users\chris\documents\visual studio
2010\Projects\MySQLBackup\MySQLBackup\Properties\Settings.Designer.cs:line
43 at MySQLBackup.SqlDatabaseWork..ctor() in
c:\users\chris\documents\visual studio
2010\Projects\MySQLBackup\MySQLBackup\Logic\SqlDatabaseWork.cs:line 25
I've managed to resolve it. I think it was something to do with the user.config file that is created by the application. I deleted the user.config and then told visual studio to rebuild and then it seemed to work.
Thanks for your help
I'm writing a Visual Studio 2008 add-in and all was working fine, but few days, sometimes, there are strange errors about Serialization (unable to find assembly).
My addins compile work, and runtime too.
When open new instance Visual Studio, my addin fails when click menu option.
but then if open solution all works (few sometimes fails)
code:
private void AbrirFicheroMfa()
{
using (Stream containerStream = File.OpenRead(this.FicheroMFA))
{
mfaContainer = this.Deserialize(containerStream);
containerStream.Close();
}
}
public MfaContainer Deserialize(Stream serializationStream)
{
var formatter = new BinaryFormatter();
return (MfaContainer)formatter.Deserialize(serializationStream);
}
error:
Error al abrir Mfa en VisorMfa: Unable
to find assembly
'COMPANY.LifeCycle.Mfa,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=9744987c0853bf9e'.
Tipo:
System.Runtime.Serialization.SerializationException
Mensaje: Unable to find assembly
'COMPANY.LifeCycle.Mfa,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=9744987c0853bf9e'.
StackTrace:
at
System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo
assemblyInfo, String name)
at
System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String
objectName, String[] memberNames,
BinaryTypeEnum[] binaryTypeEnumA,
Object[] typeInformationA, Int32[]
memberAssemIds, ObjectReader
objectReader, Int32 objectId,
BinaryAssemblyInfo assemblyInfo,
SizedArray assemIdToAssemblyTable)
at
System.Runtime.Serialization.Formatters.Binary.ObjectMap.Create(String
name, String[] memberNames,
BinaryTypeEnum[] binaryTypeEnumA,
Object[] typeInformationA, Int32[]
memberAssemIds, ObjectReader
objectReader, Int32 objectId,
BinaryAssemblyInfo assemblyInfo,
SizedArray assemIdToAssemblyTable)
at
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped
record)
at
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum
binaryHeaderEnum)
at
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler
handler, __BinaryParser serParser,
Boolean fCheck, Boolean
isCrossAppDomain, IMethodCallMessage
methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream
serializationStream, HeaderHandler
handler, Boolean fCheck, Boolean
isCrossAppDomain, IMethodCallMessage
methodCallMessage) at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream
serializationStream)
at
COMPANY.VSIntegration.ComunDespliegue.Visualizadores.FrmVisorMfaICSharpCode.Deserialize(Stream
serializationStream) in
E:\TFS\pro\COMPANYTeam\Main\Public\COMPANYDevelopment\COMPANY.VSIntegration.ComunDespliegue\Visualizadores\VisorMfa\FrmVisorMfa.cs:line
139
at
COMPANY.VSIntegration.ComunDespliegue.Visualizadores.FrmVisorMfaICSharpCode.AbrirFicheroMfa()
in
E:\TFS\pro\COMPANYTeam\Main\Public\COMPANYDevelopment\COMPANY.VSIntegration.ComunDespliegue\Visualizadores\VisorMfa\FrmVisorMfa.cs:line
131
at
COMPANY.VSIntegration.ComunDespliegue.Visualizadores.FrmVisorMfaICSharpCode.FrmICSharpCode_Load(Object
sender, EventArgs e) in
E:\TFS\pro\COMPANYTeam\Main\Public\COMPANYDevelopment\COMPANY.VSIntegration.ComunDespliegue\Visualizadores\VisorMfa\FrmVisorMfa.cs:line
72
any suggestions ?
update:
once I get this error:
SerializationException:
[A]COMPANY.LifeCycle.Mfa.MfaContainer
cannot be cast to
[B]COMPANY.LifeCycle.Mfa.MfaContainer.
Type A originates from
'COMPANY.LifeCycle.Mfa,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=null' in the context
'LoadFrom' at location
'C:\Projects\Addins\Mfa\COMPANY.LifeCycle.Mfa.dll'.
Type B originates from
'COMPANY.LifeCycle.Mfa,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=null' in the context
'LoadNeither' at location
'C:\Documents and Settings\eprados\ConfiguraciĆ³n local\Datos de programa\Microsoft\VisualStudio\9.0\ProjectAssemblies\wi3h64z601\COMPANY.LifeCycle.Mfa.dll'.
I have an WinForms application and all is work. Serialization is ok.
For VS Addin, I have:
Addin.dll references
ComunDespliegue.dll and
LifeCycle.Mfa.dll
ComunDespliegue.dll references
LifeCycle.Mfa.dll
For WinForms app, I have:
UI.Client.dll references
ComunDespliegue.dll and
LifeCycle.Mfa.dll
The assembly reside in the addin directory alongside my addin. the type i'm serializing is serializable. The COMPANY.LifeCycle.Mfa.dll is the same.
Use Fuslogvw.exe to find out where the CLR looked for the assembly. There are two basic reasons. First is that you incremented the [AssemblyVersion] of the assembly in a recent update and are trying to deserialize data that was saved with the old version of the assembly.
The second is that it simply cannot find the DLL. There are but a few places where you can store an assembly so that it can be found when VS is running. Either the GAC or the PrivateAssemblies or PublicAssemblies subdirectory of Visual Studio's Common7\IDE directory.