[MonoDevelop] Problems with assembly loading under TextTransform.exe

Tom Cook tom.k.cook at gmail.com
Wed Nov 25 12:50:37 UTC 2015


Ugh, I don't know why copy-paste is killing off the line endings.  I think
the relevant line is this:

Mono: The class System.Collections.Immutable.ImmutableArray`1 could not be
loaded, used in System.Collections.Immutable, Version=1.1.20.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

But why could it not be loaded?  What's different about the environment in
TextTransform.exe to the console application?

Tom

On Wed, 25 Nov 2015 at 12:44 Tom Cook <tom.k.cook at gmail.com> wrote:

> And below is the relevant out of the output from running it with
> MONO_LOG_LEVEL=debug mono --debug...
>
> Mono: Assembly Loader probing location: '/usr/lib/T4CSTest.dll'. Mono:
> Assembly Loader probing location: '/usr/lib/mono/4.5/Facades/T4CSTest.dll'.
> Mono: Assembly Loader probing location: '/usr/lib/T4CSTest.exe'. Mono:
> Assembly Loader probing location: '/usr/lib/mono/4.5/Facades/T4CSTest.exe'.
> Mono: AOT: FOUND method System.Collections.Generic.Dictionary`2:ContainsKey
> (TKey) [0x7fc45233dc60 - 0x7fc45233dc8b 0x7fc4527b265c] Mono: AOT: FOUND
> method System.MulticastDelegate:GetInvocationList () [0x7fc45266c020 -
> 0x7fc45266c0ed 0x7fc4527c9a92] Mono: Assembly Loader probing location:
> '../T4CSTest/bin/Debug/T4CSTest.dll'. Mono: Image addref
> T4CSTest[0x28e4040] ->
> /home/teamcity/T4CSTest/T4CSTest/bin/Debug/T4CSTest.dll[0x29445c0]: 2 Mono:
> Assembly T4CSTest[0x28e4040] added to domain TextTransform.exe, ref_count=1
> Mono: AOT module '/home/teamcity/T4CSTest/T4CSTest/bin/Debug/
> T4CSTest.dll.so' not found: /home/teamcity/T4CSTest/T4CSTest/bin/Debug/
> T4CSTest.dll.so: cannot open shared object file: No such file or
> directory Mono: AOT module '/usr/lib/mono/aot-cache/amd64/T4CSTest.dll.so'
> not found: /usr/lib/mono/aot-cache/amd64/T4CSTest.dll.so: cannot open
> shared object file: No such file or directory Mono: Assembly Loader loaded
> assembly from location: '../T4CSTest/bin/Debug/T4CSTest.dll'. Mono: Config
> attempting to parse:
> '/home/teamcity/T4CSTest/T4CSTest/bin/Debug/T4CSTest.dll.config'. Mono:
> Config attempting to parse:
> '/etc/mono/assemblies/T4CSTest/T4CSTest.config'. Mono: Assembly Ref addref
> 79a1c47c[0x2913cc0] -> T4CSTest[0x28e4040]: 2 Mono: Assembly Ref addref
> T4CSTest[0x28e4040] -> mscorlib[0x24ccb10]: 10 Mono: Assembly Loader
> probing location:
> '/usr/lib/mono/gac/Microsoft.CodeAnalysis/0.6.0.0__31bf3856ad364e35/Microsoft.CodeAnalysis.dll'.
> Mono: Assembly Loader probing location:
> '/usr/lib/Microsoft.CodeAnalysis.dll'. Mono: Assembly Loader probing
> location: '/usr/lib/mono/4.5/Facades/Microsoft.CodeAnalysis.dll'. Mono:
> Assembly Loader probing location:
> '/usr/lib/mono/gac/Microsoft.CodeAnalysis/0.6.0.0__31bf3856ad364e35/Microsoft.CodeAnalysis.exe'.
> Mono: Assembly Loader probing location:
> '/usr/lib/Microsoft.CodeAnalysis.exe'. Mono: Assembly Loader probing
> location: '/usr/lib/mono/4.5/Facades/Microsoft.CodeAnalysis.exe'. Mono:
> Assembly Loader probing location:
> '../T4CSTest/bin/Debug/Microsoft.CodeAnalysis.dll'. Mono: Image addref
> Microsoft.CodeAnalysis[0x2946610] ->
> /home/teamcity/T4CSTest/T4CSTest/bin/Debug/Microsoft.CodeAnalysis.dll[0x2945260]:
> 2 Mono: Assembly Microsoft.CodeAnalysis[0x2946610] added to domain
> TextTransform.exe, ref_count=1 Mono: AOT module
> '/home/teamcity/T4CSTest/T4CSTest/bin/Debug/Microsoft.CodeAnalysis.dll.so'
> not found: /home/teamcity/T4CSTest/T4CSTest/bin/Debug/
> Microsoft.CodeAnalysis.dll.so: cannot open shared object file: No such
> file or directory Mono: AOT module '/usr/lib/mono/aot-cache/amd64/
> Microsoft.CodeAnalysis.dll.so' not found: /usr/lib/mono/aot-cache/amd64/
> Microsoft.CodeAnalysis.dll.so: cannot open shared object file: No such
> file or directory Mono: Assembly Loader loaded assembly from location:
> '../T4CSTest/bin/Debug/Microsoft.CodeAnalysis.dll'. Mono: Config attempting
> to parse:
> '/home/teamcity/T4CSTest/T4CSTest/bin/Debug/Microsoft.CodeAnalysis.dll.config'.
> Mono: Config attempting to parse:
> '/etc/mono/assemblies/Microsoft.CodeAnalysis/Microsoft.CodeAnalysis.config'.
> Mono: Assembly Ref addref T4CSTest[0x28e4040] ->
> Microsoft.CodeAnalysis[0x2946610]: 2 Mono: Assembly Ref addref
> Microsoft.CodeAnalysis[0x2946610] -> mscorlib[0x24ccb10]: 11 Mono: Assembly
> Loader probing location:
> '/usr/lib/mono/gac/Microsoft.CodeAnalysis.CSharp/0.6.0.0__31bf3856ad364e35/Microsoft.CodeAnalysis.CSharp.dll'.
> Mono: Assembly Loader probing location:
> '/usr/lib/Microsoft.CodeAnalysis.CSharp.dll'. Mono: Assembly Loader probing
> location: '/usr/lib/mono/4.5/Facades/Microsoft.CodeAnalysis.CSharp.dll'.
> Mono: Assembly Loader probing location:
> '/usr/lib/mono/gac/Microsoft.CodeAnalysis.CSharp/0.6.0.0__31bf3856ad364e35/Microsoft.CodeAnalysis.CSharp.exe'.
> Mono: Assembly Loader probing location:
> '/usr/lib/Microsoft.CodeAnalysis.CSharp.exe'. Mono: Assembly Loader probing
> location: '/usr/lib/mono/4.5/Facades/Microsoft.CodeAnalysis.CSharp.exe'.
> Mono: Assembly Loader probing location:
> '../T4CSTest/bin/Debug/Microsoft.CodeAnalysis.dll'. Mono: AOT module
> '/home/teamcity/T4CSTest/T4CSTest/bin/Debug/Microsoft.CodeAnalysis.dll.so'
> not found: /home/teamcity/T4CSTest/T4CSTest/bin/Debug/
> Microsoft.CodeAnalysis.dll.so: cannot open shared object file: No such
> file or directory Mono: AOT module '/usr/lib/mono/aot-cache/amd64/
> Microsoft.CodeAnalysis.dll.so' not found: /usr/lib/mono/aot-cache/amd64/
> Microsoft.CodeAnalysis.dll.so: cannot open shared object file: No such
> file or directory Mono: Assembly Loader probing location:
> '../T4CSTest/bin/Debug/Microsoft.CodeAnalysis.CSharp.dll'. Mono: Image
> addref Microsoft.CodeAnalysis.CSharp[0x28ed340] ->
> /home/teamcity/T4CSTest/T4CSTest/bin/Debug/Microsoft.CodeAnalysis.CSharp.dll[0x28ebfa0]:
> 2 Mono: Assembly Microsoft.CodeAnalysis.CSharp[0x28ed340] added to domain
> TextTransform.exe, ref_count=1 Mono: AOT module
> '/home/teamcity/T4CSTest/T4CSTest/bin/Debug/
> Microsoft.CodeAnalysis.CSharp.dll.so' not found:
> /home/teamcity/T4CSTest/T4CSTest/bin/Debug/
> Microsoft.CodeAnalysis.CSharp.dll.so: cannot open shared object file: No
> such file or directory Mono: AOT module '/usr/lib/mono/aot-cache/amd64/
> Microsoft.CodeAnalysis.CSharp.dll.so' not found:
> /usr/lib/mono/aot-cache/amd64/Microsoft.CodeAnalysis.CSharp.dll.so:
> cannot open shared object file: No such file or directory Mono: Assembly
> Loader loaded assembly from location:
> '../T4CSTest/bin/Debug/Microsoft.CodeAnalysis.CSharp.dll'. Mono: Config
> attempting to parse:
> '/home/teamcity/T4CSTest/T4CSTest/bin/Debug/Microsoft.CodeAnalysis.CSharp.dll.config'.
> Mono: Config attempting to parse:
> '/etc/mono/assemblies/Microsoft.CodeAnalysis.CSharp/Microsoft.CodeAnalysis.CSharp.config'.
> Mono: Assembly Ref addref T4CSTest[0x28e4040] ->
> Microsoft.CodeAnalysis.CSharp[0x28ed340]: 2 Mono: Assembly Ref addref
> Microsoft.CodeAnalysis.CSharp[0x28ed340] ->
> Microsoft.CodeAnalysis[0x2946610]: 3 Mono: Assembly Loader probing
> location:
> '/usr/lib/mono/gac/System.Collections.Immutable/1.1.20.0__b03f5f7f11d50a3a/System.Collections.Immutable.dll'.
> Mono: Assembly Loader probing location:
> '/usr/lib/System.Collections.Immutable.dll'. Mono: Assembly Loader probing
> location: '/usr/lib/mono/4.5/Facades/System.Collections.Immutable.dll'.
> Mono: Assembly Loader probing location:
> '/usr/lib/mono/gac/System.Collections.Immutable/1.1.20.0__b03f5f7f11d50a3a/System.Collections.Immutable.exe'.
> Mono: Assembly Loader probing location:
> '/usr/lib/System.Collections.Immutable.exe'. Mono: Assembly Loader probing
> location: '/usr/lib/mono/4.5/Facades/System.Collections.Immutable.exe'.
> Mono: Assembly Loader probing location:
> '../T4CSTest/bin/Debug/System.Collections.Immutable.dll'. Mono: Image
> addref System.Collections.Immutable[0x2929140] ->
> /home/teamcity/T4CSTest/T4CSTest/bin/Debug/System.Collections.Immutable.dll[0x2927c90]:
> 2 Mono: Assembly System.Collections.Immutable[0x2929140] added to domain
> TextTransform.exe, ref_count=1 Mono: AOT module
> '/home/teamcity/T4CSTest/T4CSTest/bin/Debug/
> System.Collections.Immutable.dll.so' not found:
> /home/teamcity/T4CSTest/T4CSTest/bin/Debug/
> System.Collections.Immutable.dll.so: cannot open shared object file: No
> such file or directory Mono: AOT module '/usr/lib/mono/aot-cache/amd64/
> System.Collections.Immutable.dll.so' not found:
> /usr/lib/mono/aot-cache/amd64/System.Collections.Immutable.dll.so: cannot
> open shared object file: No such file or directory Mono: Assembly Loader
> loaded assembly from location:
> '../T4CSTest/bin/Debug/System.Collections.Immutable.dll'. Mono: Config
> attempting to parse:
> '/home/teamcity/T4CSTest/T4CSTest/bin/Debug/System.Collections.Immutable.dll.config'.
> Mono: Config attempting to parse:
> '/etc/mono/assemblies/System.Collections.Immutable/System.Collections.Immutable.config'.
> Mono: Assembly Loader probing location:
> '/usr/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll'. Mono: AOT
> module '/usr/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll.so'
> not found: /usr/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/
> System.dll.so: cannot open shared object file: No such file or directory
> Mono: AOT module '/usr/lib/mono/aot-cache/amd64/System.dll.so' not found:
> /usr/lib/mono/aot-cache/amd64/System.dll.so: cannot open shared object
> file: No such file or directory Mono: Assembly Ref addref
> Microsoft.CodeAnalysis[0x2946610] -> System[0x25345f0]: 7 Mono: The class
> System.Collections.Immutable.ImmutableArray`1 could not be loaded, used in
> System.Collections.Immutable, Version=1.1.20.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a Mono: Assembly Ref addref
> Microsoft.CodeAnalysis.CSharp[0x28ed340] -> mscorlib[0x24ccb10]: 12 Invalid
> type Microsoft.CodeAnalysis.SyntaxTree for instance field
> Microsoft.CodeAnalysis.SyntaxNode:_syntaxTree Mono: Assembly Ref addref
> T4CSTest[0x28e4040] -> System.Core[0x264d620]: 3 Mono: Assembly Ref addref
> Microsoft.CodeAnalysis.CSharp[0x28ed340] ->
> System.Collections.Immutable[0x2929140]: 2 Mono: Assembly Loader probing
> location:
> '/usr/lib/mono/gac/System.Runtime/4.0.0.0__b03f5f7f11d50a3a/System.Runtime.dll'.
> Mono: Assembly Loader probing location: '/usr/lib/System.Runtime.dll'.
> Mono: Assembly Loader probing location:
> '/usr/lib/mono/4.5/Facades/System.Runtime.dll'. Mono: Image addref
> System.Runtime[0x2930740] ->
> /usr/lib/mono/4.5/Facades/System.Runtime.dll[0x292f850]: 2 Mono: Assembly
> System.Runtime[0x2930740] added to domain TextTransform.exe, ref_count=1
> Mono: AOT module '/usr/lib/mono/4.5/Facades/System.Runtime.dll.so' not
> found: /usr/lib/mono/4.5/Facades/System.Runtime.dll.so: cannot open
> shared object file: No such file or directory Mono: AOT module
> '/usr/lib/mono/aot-cache/amd64/System.Runtime.dll.so' not found:
> /usr/lib/mono/aot-cache/amd64/System.Runtime.dll.so: cannot open shared
> object file: No such file or directory Mono: Assembly Loader loaded
> assembly from location: '/usr/lib/mono/4.5/Facades/System.Runtime.dll'.
> Mono: Config attempting to parse:
> '/usr/lib/mono/4.5/Facades/System.Runtime.dll.config'. Mono: Config
> attempting to parse:
> '/etc/mono/assemblies/System.Runtime/System.Runtime.config'. Mono: Assembly
> Ref addref System.Collections.Immutable[0x2929140] ->
> System.Runtime[0x2930740]: 2 Mono: Assembly Ref addref
> System.Runtime[0x2930740] -> mscorlib[0x24ccb10]: 13 Mono: AOT: FOUND
> method System.TypeLoadException:.ctor () [0x7fc4524cd040 - 0x7fc4524cd068
> 0x7fc4527bd3fe] Mono: AOT: FOUND method
> System.Reflection.TargetInvocationException:.ctor (System.Exception)
> [0x7fc4525b0bd0 - 0x7fc4525b0bf7 0x7fc4527c3202] Mono: AOT: FOUND method
> System.Exception:ToString () [0x7fc4526655d0 - 0x7fc452665721
> 0x7fc4527c97bb] Mono: AOT: FOUND method System.RuntimeType:ToString ()
> [0x7fc4523fca80 - 0x7fc4523fca96 0x7fc4527b7aee] Mono: AOT: NOT FOUND:
> System.RuntimeType:getFullName (bool,bool). Mono: AOT: FOUND method
> System.Exception:get_Message () [0x7fc452665110 - 0x7fc45266516d
> 0x7fc4527c9785] Mono: AOT: FOUND method
> System.TypeLoadException:get_Message () [0x7fc4524cd2a0 - 0x7fc4524cd2ba
> 0x7fc4527bd414] Mono: AOT: FOUND method
> System.TypeLoadException:SetMessageField () [0x7fc4524cd2c0 -
> 0x7fc4524cd419 0x7fc4527bd416] Mono: AOT: FOUND method
> System.Exception:get_StackTrace () [0x7fc4526652c0 - 0x7fc45266534d
> 0x7fc4527c9793] Mono: AOT: NOT FOUND:
> System.Diagnostics.StackTrace:get_trace (System.Exception,int,bool). Mono:
> AOT: FOUND method System.Diagnostics.StackTrace:ToString () [0x7fc45254a810
> - 0x7fc45254a8f5 0x7fc4527c0637] Mono: AOT: FOUND method
> System.Diagnostics.StackTrace:AddFrames (System.Text.StringBuilder)
> [0x7fc45254a100 - 0x7fc45254a4bf 0x7fc4527c0603] Mono: AOT: FOUND method
> System.Diagnostics.StackTrace:get_FrameCount () [0x7fc45254a050 -
> 0x7fc45254a07d 0x7fc4527c05fd] Mono: AOT: FOUND method
> System.Diagnostics.StackTrace:GetFrame (int) [0x7fc45254a080 -
> 0x7fc45254a0e0 0x7fc4527c05ff] Mono: AOT: FOUND method
> System.Text.StringBuilder:AppendFormat (string,object,object)
> [0x7fc452472260 - 0x7fc4524722e0 0x7fc4527bab5c] Mono: AOT: FOUND method
> System.Diagnostics.StackFrame:GetMethod () [0x7fc452549a70 - 0x7fc452549a84
> 0x7fc4527c05c3] Mono: AOT: FOUND method
> System.Diagnostics.StackTrace:GetFullNameForStackTrace
> (System.Text.StringBuilder,System.Reflection.MethodBase) [0x7fc45254a4c0 -
> 0x7fc45254a80f 0x7fc4527c0625] Mono: AOT: FOUND method
> System.RuntimeType:GetMethods (System.Reflection.BindingFlags)
> [0x7fc4523f53e0 - 0x7fc4523f543a 0x7fc4527b7761] Mono: AOT: NOT FOUND:
> System.Reflection.MemberInfo:get_MetadataToken (). Mono: AOT: FOUND method
> System.Reflection.MonoMethod:get_Name () [0x7fc4525abb40 - 0x7fc4525abb6c
> 0x7fc4527c2f98] Mono: AOT: NOT FOUND: System.Reflection.MonoMethod:get_name
> (System.Reflection.MethodBase). Mono: AOT: FOUND method
> System.Reflection.ParameterInfo:get_Name () [0x7fc4525af610 -
> 0x7fc4525af624 0x7fc4527c3124] Mono: AOT: FOUND method
> System.Diagnostics.StackFrame:GetILOffset () [0x7fc452549a50 -
> 0x7fc452549a64 0x7fc4527c05c1] Mono: AOT: FOUND method
> System.NumberFormatter:ParsePrecision (string) [0x7fc45266d9b0 -
> 0x7fc45266da57 0x7fc4527c9bec] Mono: AOT: FOUND method
> System.Diagnostics.StackFrame:GetSecureFileName () [0x7fc4525499d0 -
> 0x7fc452549a41 0x7fc4527c05bd] Mono: AOT: FOUND method
> System.Diagnostics.StackFrame:GetFileName () [0x7fc452549930 -
> 0x7fc4525499c8 0x7fc4527c05b7] Mono: AOT: FOUND method
> System.Diagnostics.StackFrame:GetFileLineNumber () [0x7fc4525498f0 -
> 0x7fc452549904 0x7fc4527c05b3] Mono: AOT: FOUND method
> System.Diagnostics.StackFrame:GetNativeOffset () [0x7fc452549a90 -
> 0x7fc452549aa4 0x7fc4527c05c5] Mono: AOT: FOUND method long:ToString
> (string,System.IFormatProvider) [0x7fc4523bec20 - 0x7fc4523bec5e
> 0x7fc4527b5ffd] Mono: AOT: FOUND method
> System.NumberFormatter:NumberToString (string,long,System.IFormatProvider)
> [0x7fc45266f140 - 0x7fc45266f1ad 0x7fc4527c9c9f] Mono: AOT: FOUND method
> System.NumberFormatter:Init (string,long) [0x7fc45266dd40 - 0x7fc45266dde3
> 0x7fc4527c9c00] Mono: AOT: FOUND method
> System.Collections.CollectionBase:System.Collections.IList.get_Item (int)
> [0x7fc45233a9e0 - 0x7fc45233aa5d 0x7fc4527b24f1] Mono: AOT: FOUND method
> System.AppDomain:remove_AssemblyResolve (System.ResolveEventHandler)
> [0x7fc452530380 - 0x7fc452530461 0x7fc4527bfd56] Mono: AOT: FOUND method
> System.Delegate:Remove (System.Delegate,System.Delegate) [0x7fc452664290 -
> 0x7fc4526643b3 0x7fc4527c9709] Mono: AOT: FOUND method
> System.MulticastDelegate:RemoveImpl (System.Delegate) [0x7fc45266c350 -
> 0x7fc45266c77c 0x7fc4527c9aa4] Mono: AOT: FOUND method
> System.MulticastDelegate:Equals (object) [0x7fc45266be90 - 0x7fc45266bff4
> 0x7fc4527c9a8c] Mono: AOT: FOUND method System.Delegate:Equals (object)
> [0x7fc452663f80 - 0x7fc4526640f5 0x7fc4527c96f4] Mono: AOT: FOUND method
> System.Delegate:get_Method () [0x7fc452662ae0 - 0x7fc452662bdc
> 0x7fc4527c96af] Mono: AOT: FOUND method
> System.Reflection.MethodBase:GetMethodFromHandleNoGenericCheck
> (System.RuntimeMethodHandle) [0x7fc4523e4620 - 0x7fc4523e4640
> 0x7fc4527b70e7] Mono: AOT: NOT FOUND:
> System.Reflection.MethodBase:GetMethodFromHandleInternalType
> (intptr,intptr). Mono: AOT: FOUND method System.Console:WriteLine
> (string,object) [0x7fc452660830 - 0x7fc452660877 0x7fc4527c92f8] Mono: AOT:
> FOUND method System.IO.TextWriter/SyncTextWriter:WriteLine (string,object)
> [0x7fc4523d6570 - 0x7fc4523d65a4 0x7fc4527b6c1e] Mono: AOT: FOUND method
> System.IO.TextWriter:WriteLine (string,object) [0x7fc4523d4e90 -
> 0x7fc4523d4f0d 0x7fc4527b6ab6] Mono: AOT: FOUND method
> System.IO.CStreamWriter:Write (char[],int,int) [0x7fc45265eff0 -
> 0x7fc45265f280 0x7fc4527c9137] Processing 'T4Template.tt' failed. Mono:
> AOT: FOUND method System.Console:get_Error () [0x7fc45265faf0 -
> 0x7fc45265fb19 0x7fc4527c91ab] Mono: AOT: FOUND method
> System.IO.TextWriter/SyncTextWriter:WriteLine (string,object[])
> [0x7fc4523d6640 - 0x7fc4523d6674 0x7fc4527b6c24] Mono: AOT: FOUND method
> System.IO.TextWriter:WriteLine (string,object[]) [0x7fc4523d5090 -
> 0x7fc4523d50da 0x7fc4527b6ac5] (0,0): ERROR Error running transform:
> System.Reflection.TargetInvocationException: Exception has been thrown by
> the target of an invocation. ---> System.TypeLoadException: Failure has
> occurred while loading a type. at T4CSTest.Utilities.GetFirstNamespace
> (System.String code) [0x00011] in
> /home/teamcity/T4CSTest/T4CSTest/Program.cs:13 at
> Microsoft.VisualStudio.TextTemplating.GeneratedTextTransformation54909918.TransformText
> () <0x40529fc0 + 0x00087> in <filename unknown>:0 at (wrapper
> managed-to-native) System.Reflection.MonoMethod:InternalInvoke
> (System.Reflection.MonoMethod,object,object[],System.Exception&) at
> System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
> invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
> System.Globalization.CultureInfo culture) <0x7fc4525ab780 + 0x000a1> in
> <filename unknown>:0 --- End of inner exception stack trace --- at
> System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
> invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
> System.Globalization.CultureInfo culture) <0x7fc4525ab780 + 0x000ef> in
> <filename unknown>:0 at System.Reflection.MethodBase.Invoke (System.Object
> obj, System.Object[] parameters) <0x7fc4523e3cf0 + 0x0002a> in <filename
> unknown>:0 at Mono.TextTemplating.CompiledTemplate.Process () <0x40529540 +
> 0x0036f> in <filename unknown>:0
>
> On Wed, 25 Nov 2015 at 12:13 Tom Cook <tom.k.cook at gmail.com> wrote:
>
>> I've posted a sample project that demonstrates this problem (or one very
>> similar to it) at https://github.com/tomkcook/T4CSTest
>>
>> To use it:
>>
>>
>>    - Open the T4CSTest solution in MonoDevelop.
>>    - Restore packages for the T4CSTest project.
>>    - Build the T4CSTest project (this is a library that uses the
>>    Microsoft.CodeAnalysis.* assemblies).  The Utilities class has a single
>>    method called GetFirstNamespace(string) that returns the code of the first
>>    namespace in the string it is passed.
>>    - Build the Templates project and run the resulting executable - this
>>    is a C# programme that shows that the GetFirstNamespace method working.
>>    - At the command-line:
>>    cd T4CSTest/Templates
>>    /usr/lib/monodevelop/AddIns/MonoDevelop.TextTemplating/TextTransform.exe
>>    -P=../T4CSTest/bin/Debug T4Template.tt
>>
>> It produces the following output:
>>
>> Invalid type Microsoft.CodeAnalysis.SyntaxTree for instance field
>> Microsoft.CodeAnalysis.SyntaxNode:_syntaxTree Processing 'T4Template.tt'
>> failed. (0,0): ERROR Error running transform:
>> System.Reflection.TargetInvocationException: Exception has been thrown by
>> the target of an invocation. ---> System.TypeLoadException: Failure has
>> occurred while loading a type. at T4CSTest.Utilities.GetFirstNamespace
>> (System.String code) <0x414484c0 + 0x0002f> in <filename unknown>:0 at
>> Microsoft.VisualStudio.TextTemplating.GeneratedTextTransformation5c65abe6.TransformText
>> () <0x41447fa0 + 0x00087> in <filename unknown>:0 at (wrapper
>> managed-to-native) System.Reflection.MonoMethod:InternalInvoke
>> (System.Reflection.MonoMethod,object,object[],System.Exception&) at
>> System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
>> invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
>> System.Globalization.CultureInfo culture) <0x7f32871ab780 + 0x000a1> in
>> <filename unknown>:0 --- End of inner exception stack trace --- at
>> System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
>> invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
>> System.Globalization.CultureInfo culture) <0x7f32871ab780 + 0x000ef> in
>> <filename unknown>:0 at System.Reflection.MethodBase.Invoke (System.Object
>> obj, System.Object[] parameters) <0x7f3286fe3cf0 + 0x0002a> in <filename
>> unknown>:0 at Mono.TextTemplating.CompiledTemplate.Process () <0x41447520 +
>> 0x0036f> in <filename unknown>:0
>>
>> On Wed, 25 Nov 2015 at 09:36 Tom Cook <tom.k.cook at gmail.com> wrote:
>>
>>> I'm porting some T4 templates from the Microsoft .NET Framework to
>>> Mono.  They use an in-house assembly called DataModelDefinition, which in
>>> turn uses the Microsoft.CodeAnalysis and Microsoft.CodeAnalysis.CSharp
>>> assemblies to process some C# code.
>>>
>>> When I try to run one of these templates, I get the following error:
>>>
>>> > $ TextTransform.exe -P=<path to assemblies> -o test.txt ProcessFiles.tt
>>> > <a bunch of expected output from my code>
>>> > Invalid type Microsoft.CodeAnalysis.SyntaxTree for instance field
>>> Microsoft.CodeAnalysis.SyntaxNode:_syntaxTree
>>> > Invalid type Microsoft.CodeAnalysis.SyntaxNode for instance field
>>> Microsoft.CodeAnalysis.SyntaxToken:parent
>>> > Failed to generate <path>/ProjectInfo.xml because :
>>> > Could not load type 'Microsoft.CodeAnalysis.SyntaxToken' from assembly
>>> 'Microsoft.CodeAnalysis, Version=0.6.0.0, Culture=neutral,
>>> PublicKeyToken=31bf3856ad364e35'.
>>> >
>>> > Stack trace:
>>> >   <a bunch of files within the DataModelDefinition assembly>
>>>
>>> But if I write a stand-alone console programme that references the same
>>> assemblies and invokes the same method, it works without a problem.
>>>
>>> What could cause the failure to load these types?
>>>
>>> I'm trying to put together a simple test case that demonstrates the
>>> problem; I'll get back when I've got something together.
>>>
>>> Regards,
>>> Tom
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monodevelop-list/attachments/20151125/7bb4a72b/attachment-0001.html>


More information about the Monodevelop-list mailing list