Load assembly in async Task asp.net - c#

I run async Task which uses code from referenced DLL. In this case I cat error message that this referenced DLL can not be found.
Message: Unable to find assembly 'Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'.
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.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.CrossAppDomainSerializer.DeserializeObject(MemoryStream stm)
at System.AppDomain.Deserialize(Byte[] blob)
at System.AppDomain.UnmarshalObject(Byte[] blob)
If the code is in async Task then DLLs are taken from different location? Should I install it to GAC?
This is my web.config:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
In Bin folder I have a Newtonsoft.Json.Dll, I run powershell script to check what is the version and it is:
[Reflection.AssemblyName]::GetAssemblyName('MyLocation\Newtonsoft.Json.DLL').Version
And the result is:
Major Minor Build Revision
----- ----- ----- --------
8 0 0 0
Then I wanted to check which assemblies are loaded into w3wp.exe process using listDlls.exe and there is:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\xxx\Newtonsoft.Json.DLL
So I navigated there copied the dll and checked the version (just to be sure) and it is 8.0.0.0
I'm not sure what else can I do :D

I see that this is a cross domain serailization exception coming from
CrossAppDomainSerializer and this is used as Remoting
Infrastructure Sink for making calls across context boundaries
This is an issue originating from your code and remoting is done,please refer this SO post .
Hope this helps!

Related

Is it possible to get out of this Nuget Hell scenario?

I want my project to have the following packages
Microsoft.Azure.ServiceBus
Microsoft.Azure.WebJobs.Extensions
Microsoft.Azure.WebJobs.Extensions.Storage
Microsoft.Azure.WebJobs.ServiceBus
Microsoft.NET.Sdk.Functions
.NETStandard Library
Newtonsoft.Json
Right now I have the most recent versions
Microsoft.Azure.ServiceBus (3.1.1)
Microsoft.Azure.WebJobs.Extensions (3.0.0)
Microsoft.Azure.WebJobs.Extensions.Storage (3.0.0)
Microsoft.Azure.WebJobs.ServiceBus (v3.0.0-beta8)
Microsoft.NET.Sdk.Functions (1.0.22)
.NETStandard Library (2.0.1)
Newtonsoft.Json(11.0.2)
Which have the following dependencies of WebJobs:
Microsoft.Azure.ServiceBus [None]
Microsoft.Azure.WebJobs.Extensions [Microsoft.Azure.WebJobs (>= 3.0.0)]
Microsoft.Azure.WebJobs.Extensions.Storage [Microsoft.Azure.WebJobs (>= 3.0.0)]
Microsoft.Azure.WebJobs.ServiceBus [Microsoft.Azure.WebJobs (= 2.2.0)]
Microsoft.NET.Sdk.Functions [Microsoft.Azure.WebJobs (>= 3.0.0 && < 3.1.0)]
.NETStandard Library [None]
Newtonsoft.Json [None]
Interestingly, Visual Studio isn't flagging this as a problem (no yellow triangles in Solution Explorer), even though there are clearly conflicting version requirements. When I try to build my Function App project I get the error
Severity Code Description Project File Line Suppression State
Error System.IO.FileNotFoundException: Could not load file or
assembly 'Microsoft.Azure.WebJobs, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=null' or one of its dependencies. The system cannot
find the file specified. File name: 'Microsoft.Azure.WebJobs,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=null' at
System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken,
IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs,
Int32 methodInstCount, ObjectHandleOnStack type) at
System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module,
Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext,
RuntimeTypeHandle[] methodInstantiationContext) at
System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken,
Type[] genericTypeArguments, Type[] genericMethodArguments) at
System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord
caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly,
RuntimeModule decoratedModule, MetadataToken decoratedToken,
RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[]
attributes, IList derivedAttributes, RuntimeType& attributeType,
IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean&
isVarArg) at
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule
decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount,
RuntimeType attributeFilterType, Boolean mustBeInheritable, IList
derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) at
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeParameterInfo
parameter, RuntimeType caType) at
System.Attribute.InternalParamGetCustomAttributes(ParameterInfo param,
Type type, Boolean inherit) at
MakeFunctionJson.ParameterInfoExtensions.GetDisabledAttribute(ParameterInfo
parameterInfo) at
System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext() at
System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext() at
System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source)
at MakeFunctionJson.MethodInfoExtensions.GetDisabled(MethodInfo
method) at
MakeFunctionJson.MethodInfoExtensions.HasUnsuportedAttributes(MethodInfo
method, String& error) at
MakeFunctionJson.FunctionJsonConverter.<GenerateFunctions>d__9.MoveNext()
at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at
MakeFunctionJson.FunctionJsonConverter.TryGenerateFunctionJsons()
at MakeFunctionJson.FunctionJsonConverter.TryRun()
WRN: Assembly binding logging is turned OFF. To enable assembly bind
failure logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There
is some performance penalty associated with assembly bind failure
logging. To turn this feature off, remove the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog].
Error generating functions metadata
Any way out of this Nuget Hell or can I not use all these packages? I've tried looking at previous versions and there seems to be no way to get them all to agree on a version of WebJobs. How does one typically resolve these situations?
Remove Microsoft.Azure.WebJobs.ServiceBus, the new package is now called Microsoft.Azure.WebJobs.Extensions.ServiceBus(3.0.0). See package references in v2 functions.
Besides, Microsoft.NET.Sdk.Functions(1.0.22) contains Newtonsoft.Json(11.0.2) and Microsoft.Azure.WebJobs.Extensions (3.0.0), no need to install them separately. And Microsoft.Azure.WebJobs.Extensions.ServiceBus(3.0.0) contains Microsoft.Azure.ServiceBus(3.0.2) as well, you don't need to install it either as long as the latest version is not necessary.
For example, you can create a v2 servicebus trigger template in VS and only need to add Microsoft.Azure.WebJobs.Extensions.Storage (3.0.0) to achieve your goal.

Could not load file or assembly System.Net, Version=2.0.5.0

I have an ASP.NET 4.5.2 application that loads the Microsoft.Azure.ActiveDirectory.GraphClient library. When it tries to connect, the following error occurs:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Net, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
File Name: "System.Net, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e"
bei System.Data.Services.Client.UriResolver.ConvertToAbsoluteUri(Uri baseUri)
bei System.Data.Services.Client.UriResolver.ConvertToAbsoluteAndValidateBaseUri(Uri& baseUri, String parameterName)
bei System.Data.Services.Client.DataServiceContext..ctor(Uri serviceRoot, DataServiceProtocolVersion maxProtocolVersion, ClientEdmModel model)
bei Microsoft.Azure.ActiveDirectory.GraphClient.Extensions.DataServiceContextWrapper..ctor(Uri serviceRoot, DataServiceProtocolVersion maxProtocolVersion, Func`1 accessTokenGetter, IEnumerable`1 customTypeMappings)
bei Microsoft.Azure.ActiveDirectory.GraphClient.ActiveDirectoryClient..ctor(Uri serviceRoot, Func`1 accessTokenGetter,...
I have added a binding redirect to my web.config already:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net" publicKeyToken="7cec85d7bea7798e" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.0.5.0" newVersion="4.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
But the problem persists. What is wrong here?

Cannot Deplay Private SQL Server CE Winforms

I got some issues when trying to install the setup.exe. In the log it says 'the referenced assembly couldn't be found on the computer(HRESULT: 0x800736B3).
Stack:
bei System.Deployment.Internal.Isolation.IStore.GetAssemblyInformation(UInt32 Flags, IDefinitionIdentity DefinitionIdentity, Guid& riid)
bei System.Deployment.Internal.Isolation.Store.GetAssemblyManifest(UInt32 Flags, IDefinitionIdentity DefinitionIdentity)
bei System.Deployment.Application.ComponentStore.GetSubscriptionStateInternal(DefinitionIdentity subId)
bei System.Deployment.Application.SubscriptionStore.GetSubscriptionStateInternal(SubscriptionState subState)
bei System.Deployment.Application.SubscriptionState.Validate()
bei System.Deployment.Application.ComponentStore.CollectCrossGroupApplications(Uri codebaseUri, DefinitionIdentity deploymentIdentity, Boolean& identityGroupFound, Boolean& locationGroupFound, String& identityGroupProductName)
bei System.Deployment.Application.SubscriptionStore.CommitApplication(SubscriptionState& subState, CommitApplicationParams commitParams)
bei System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
bei System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
bei System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
I've set everything I think. All the dlls are copied to the output dir. I've set the application to target x86.
app.config:
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<add name="Microsoft SQL Server Compact Data Provider 4.0"
invariant="System.Data.SqlServerCe"
description=".NET Framework Data Provider for Microsoft SQL Server Compact"
type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories>
</system.data>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845dcd8080cc91" culture="neutral"/>
<bindingRedirect oldVersion="4.0.0.0-4.0.0.1" newVersion="4.0.0.1"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Is there anything wrong? Or why do I still getting this issue?

Could not load file or assembly System.Runtime.Serialization after publishing via Windows Azure

I published my solution using Windows Azure sdk and now I get this error:
Server Error in '/' Application.
Could not load file or assembly 'System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified.
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.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified.
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.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Stack Trace: [FileNotFoundException: Could not load file or assembly 'System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified.]
System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0
System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +371
System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +19
System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +319
System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +203
System.Reflection.CustomAttribute.IsCustomAttributeDefined(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Int32 attributeCtorToken, Boolean mustBeInheritable) +745
System.Reflection.CustomAttribute.IsDefined(RuntimeType type, RuntimeType caType, Boolean inherit) +300
System.ServiceModel.Description.TypeLoader.CreateMessageDescription(MethodInfo methodInfo, Boolean isAsync, Boolean isTask, Type taskTResult, XmlName returnValueName, String defaultNS, String action, XmlName wrapperName, String wrapperNamespace, MessageDirection direction) +415
System.ServiceModel.Description.TypeLoader.CreateOperationDescription(ContractDescription contractDescription, MethodInfo methodInfo, MessageDirection direction, ContractReflectionInfo reflectionInfo, ContractDescription declaringContract) +1895
System.ServiceModel.Description.TypeLoader.CreateOperationDescriptions(ContractDescription contractDescription, ContractReflectionInfo reflectionInfo, Type contractToGetMethodsFrom, ContractDescription declaringContract, MessageDirection direction) +276
System.ServiceModel.Description.TypeLoader.CreateContractDescription(ServiceContractAttribute contractAttr, Type contractType, Type serviceType, ContractReflectionInfo& reflectionInfo, Object serviceImplementation) +1307
System.ServiceModel.Description.TypeLoader.LoadContractDescriptionHelper(Type contractType, Type serviceType, Object serviceImplementation) +289
System.ServiceModel.Description.ContractDescription.GetContract(Type contractType, Type serviceType) +192
System.ServiceModel.ServiceHost.CreateDescription(IDictionary`2& implementedContracts) +591
System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses) +166
System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses) +474
System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses) +42
System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +569
System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +1435
System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) +76
System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +901
[ServiceActivationException: The service '/CarManagerApi.svc' cannot be activated due to an exception during compilation. The exception message is: Could not load file or assembly 'System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified..]
System.Runtime.AsyncResult.End(IAsyncResult result) +622882
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +196075
System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +282
I can't find the error in the code.
What is the problem?
My problem was different .Net frameworks in projects on the same solution
Sounds like the framework 2.0 isn't installed on remote machine.
I ran into this problem using Newtonsoft.Json in a library. The library worked fine on Windows, but died with this error when used with Mono on OS X.
In order to get it to run I had to copy the actual System.Runtime.Serialization.dll into the application directory.
Obviously it's not a great solution but it works.

SerializationException using VS 2008 Addin: not find assemby

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.

Categories

Resources