Hi,
I've run in to a problem.
I'm using the DotNetProjectResolver and when I invoke AddExternalReference for one of my own assemblies I get the following exception:
System.ApplicationException:
Could not load exported type data for assembly 'MyAssenblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx' and type 'MyNamespace.MyType'.
---> System.IO.FileLoadException: Cannot resolve dependency to assembly 'System.Threading.Tasks, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' because it has not been preloaded.
When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.
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.RuntimeType.RuntimeTypeCache.MemberInfoCache'1.PopulateNestedClasses(Filter filter)
at System.RuntimeType.RuntimeTypeCache.MemberInfoCache'1.GetListByName(Char* pName, Int32 cNameLen, Byte* pUtf8Name, Int32 cUtf8Name, MemberListType listType, CacheType cacheType)
at System.RuntimeType.RuntimeTypeCache.MemberInfoCache'1.Populate(String name, MemberListType listType, CacheType cacheType)
at System.RuntimeType.RuntimeTypeCache.MemberInfoCache'1.GetMemberList(MemberListType listType, String name, CacheType cacheType)
at System.RuntimeType.GetNestedTypeCandidates(String fullname, BindingFlags bindingAttr, Boolean allowPrefixLookup)
at System.RuntimeType.GetMembers(BindingFlags bindingAttr)
at ai..ctor(k A_0, Type A_1)
at k..ctor(Assembly A_0, String A_1, String A_2, String A_3, Boolean A_4)
--- End of inner exception stack trace ---
at k..ctor(Assembly A_0, String A_1, String A_2, String A_3, Boolean A_4)
at ActiproSoftware.SyntaxEditor.Addons.DotNet.Dom.AssemblyCodeRepository.a.a(c A_0, ResolveEventHandler A_1)
at ActiproSoftware.SyntaxEditor.Addons.DotNet.Dom.AssemblyCodeRepository.a.a(c A_0, ResolveEventHandler A_1)
at ActiproSoftware.SyntaxEditor.Addons.DotNet.Dom.AssemblyCodeRepository.Add(String assemblyName, DotNetProjectResolver projectResolver)
at ActiproSoftware.SyntaxEditor.Addons.DotNet.Dom.DotNetProjectResolver.AddExternalReference(String assemblyName)
<call stack continued in my code>
The assembly that is specified as argument to AddExternalReference references Microsoft.CodeAnalysis. This worked fine until I updated Microsoft.CodeAnalysis to version 2.0.
In other parts of my project I can load the assembly and I can see that System.Threading.Tasks gets loaded.
Also, it's worth mentioning that I'm using an older version of this product from 2009.