Open-Systems-Pharmacology / PK-Sim

PK-Sim® is a comprehensive software tool for whole-body physiologically based pharmacokinetic modeling
Other
103 stars 50 forks source link

Error when loading compound in Visual Studio (Debug) #2934

Open msevestre opened 1 month ago

msevestre commented 1 month ago

Application: PK-Sim® 12.0.0

Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Stack trace:

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.IsCustomAttributeDefined(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Int32 attributeCtorToken, Boolean mustBeInheritable)
   at System.Reflection.CustomAttribute.IsDefined(RuntimePropertyInfo property, RuntimeType caType)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.GetSerializableMembers(Type objectType)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateProperties(Type type, MemberSerialization memberSerialization)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract(Type objectType)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract(Type type)
   at Newtonsoft.Json.Schema.Generation.JSchemaGeneratorInternal.GenerateInternal(Type type, Nullable`1 valueRequired, JsonProperty memberProperty, JsonContainerContract container, JSchemaGenerationProvider currentGenerationProvider)
   at Newtonsoft.Json.Schema.Generation.JSchemaGeneratorInternal.Generate(Type type, Required required)
   at PKSim.Infrastructure.Serialization.Json.JsonSerializer.createSchemaForType(Type snapshotType) in C:\dev\PK-Sim\src\PKSim.Infrastructure\Serialization\Json\JsonSerializer.cs:line 118
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at PKSim.Infrastructure.Serialization.Json.JsonSerializer.validateSnapshot(Type snapshotType) in C:\dev\PK-Sim\src\PKSim.Infrastructure\Serialization\Json\JsonSerializer.cs:line 111
   at PKSim.Infrastructure.Serialization.Json.JsonSerializer.deserializeAsArrayFromString(String json, Type objectType) in C:\dev\PK-Sim\src\PKSim.Infrastructure\Serialization\Json\JsonSerializer.cs:line 55
   at PKSim.Infrastructure.Serialization.Json.JsonSerializer.<DeserializeAsArray>d__3.MoveNext() in C:\dev\PK-Sim\src\PKSim.Infrastructure\Serialization\Json\JsonSerializer.cs:line 42
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at PKSim.Core.Snapshots.Services.SnapshotTask.<loadSnapshot>d__16.MoveNext() in C:\dev\PK-Sim\src\PKSim.Core\Snapshots\Services\SnapshotTask.cs:line 151
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at PKSim.Core.Snapshots.Services.SnapshotTask.<LoadSnapshotsAsync>d__15`1.MoveNext() in C:\dev\PK-Sim\src\PKSim.Core\Snapshots\Services\SnapshotTask.cs:line 142
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at PKSim.Core.Snapshots.Services.SnapshotTask.<LoadSnapshotFromFileAsync>d__14`1.MoveNext() in C:\dev\PK-Sim\src\PKSim.Core\Snapshots\Services\SnapshotTask.cs:line 131
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at PKSim.Core.Snapshots.Services.SnapshotTask.<LoadModelFromProjectFileAsync>d__24`1.MoveNext() in C:\dev\PK-Sim\src\PKSim.Core\Snapshots\Services\SnapshotTask.cs:line 218
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at PKSim.Infrastructure.ORM.Repositories.RemoteTemplateRepository.<LoadTemplateAsync>d__11`1.MoveNext() in C:\dev\PK-Sim\src\PKSim.Infrastructure\ORM\Repositories\RemoteTemplateRepository.cs:line 55
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at PKSim.Presentation.Presenters.TemplatePresenter.<loadTemplateWithReferences>d__17`1.MoveNext() in C:\dev\PK-Sim\src\PKSim.Presentation\Presenters\TemplatePresenter.cs:line 187
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at PKSim.Presentation.Presenters.TemplatePresenter.<loadMultipleTemplate>d__16`1.MoveNext() in C:\dev\PK-Sim\src\PKSim.Presentation\Presenters\TemplatePresenter.cs:line 176
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at PKSim.Presentation.Services.BuildingBlockTask.<LoadFromTemplateAsync>d__28.MoveNext() in C:\dev\PK-Sim\src\PKSim.Presentation\Services\BuildingBlockTask.cs:line 289
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at PKSim.Presentation.Services.BuildingBlockTask.<LoadSingleFromTemplateAsync>d__29`1.MoveNext() in C:\dev\PK-Sim\src\PKSim.Presentation\Services\BuildingBlockTask.cs:line 301
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at OSPSuite.Core.Extensions.ExceptionExtensions.<DoWithinExceptionHandler>d__8`1.MoveNext()
msevestre commented 1 week ago

@rwmcintosh @Yuri05 @benjaperez1983 This happens to me every single time I debug, stop and debug again Do you have the same issue? This is such a waste of time.

Yuri05 commented 1 week ago

mm didn't have this issue yet

rwmcintosh commented 1 week ago

I tried loading from template a few times with stop and restart and did not have this issue.

Does that System.ComponentModel.Annotations.dll existing in the output directory?

rwmcintosh commented 8 hours ago

I had this happen during some other operation and ran dependency walker for it. This doesn't look right lol

x86

image

msevestre commented 1 hour ago

this is new since we did all this changes for R etc.. NEver had this before I know have this EVERY single time I Debug STOP and Debug again. Freaking annoying

rwmcintosh commented 1 hour ago

There are others complaining about this problem. I'll try to figure out what the proposed fixes are doing. Don't want to just copy/paste some configuration that we have no idea what it's doing.