8000 DLL Export conflicts with Fody in Visual Studio 2015 · Issue #17 · 3F/DllExport · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
DLL Export conflicts with Fody in Visual Studio 2015 #17
Closed
@OzzyL

Description

@OzzyL

I recently upgraded from Visual Studio 2013 to 2015 and my projects where I used both DLL Export and Fody (More specifically ModuleInit.Fody) stopped working.

I have tried the same project on different computers with different versions of Visual Studio 2015. Same issue on all computers.

It seem as i can't use DLL Export together with Fody (e.g. ModuleInit). Both tools works great separately, but when both is included in a project the build fails.

The build error I get:

Severity    Code    Description Project File    Line    Suppression State
Error       C:\Users\[...]\AppData\Local\Temp\tmp4CC9\VCI_Comm_PlaybackNode.il(773) : error : Undeclared identifier IL_0055
D:\Projects\VCI_Project\trunk\VCI_Comm_Win\VCI_Comm_PlaybackNode\ConfigManager.cs(37) : error : syntax error at token ':' in:     IL_0055:  br.s       IL_0057  VCI_Comm_PlaybackNode   D:\Projects\VCI_Project\trunk\VCI_Comm_Win\packages\DllExport.1.4.0\tools\net.r_eg.DllExport.targets    61  

Using detailed buildlog I can see the following errors:

8>  calling 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\ILAsm.exe' with /nologo "/out:D:\Projects\VCI_Project\trunk\VCI_Comm_Win\VCI_Comm_PlaybackNode\bin\x86\Debug\VCI_Comm_PlaybackNode.dll" "C:\Users\[...]\AppData\Local\Temp\tmp4CC9\VCI_Comm_PlaybackNode.il" /DLL "/resource=C:\Users\[...]\AppData\Local\Temp\tmp4CC9\VCI_Comm_PlaybackNode.res"  /debug   (TaskId:101)
8>  ILAsm 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\ILAsm.exe' returned gracefully. (TaskId:101)
8>D:\Projects\VCI_Project\trunk\VCI_Comm_Win\packages\DllExport.1.4.0\tools\net.r_eg.DllExport.targets(61,5): error : C:\Users\[...]\AppData\Local\Temp\tmp4CC9\VCI_Comm_PlaybackNode.il(773) : error : Undeclared identifier IL_0055
8>D:\Projects\VCI_Project\trunk\VCI_Comm_Win\packages\DllExport.1.4.0\tools\net.r_eg.DllExport.targets(61,5): error : D:\Projects\VCI_Project\trunk\VCI_Comm_Win\VCI_Comm_PlaybackNode\ConfigManager.cs(37) : error : syntax error at token ':' in:     IL_0055:  br.s       IL_0057
8>D:\Projects\VCI_Project\trunk\VCI_Comm_Win\packages\DllExport.1.4.0\tools\net.r_eg.DllExport.targets(61,5): error : 
8>     at RGiesecke.DllExport.Parsing.IlParser.RunIlTool(String installPath, String toolFileName, String requiredPaths, String workingDirectory, String settingsName, String arguments, String toolLoggingCode, String verboseLoggingCode, IDllExportNotifier notifier, Int32 timeout, Func`2 suppressErrorOutputLine) in C:\Users\[...]\Downloads\DllExport-1.4\DllExport-1.4\RGiesecke.DllExport\Parsing\IlParser.cs:line 378
8>     at RGiesecke.DllExport.Parsing.IlAsm.RunCore(CpuPlatform cpu, String fileName, String ressourceParam, String ilSuffix) in C:\Users\[...]\Downloads\DllExport-1.4\DllExport-1.4\RGiesecke.DllExport\Parsing\ILAsm.cs:line 148
8>     at RGiesecke.DllExport.Parsing.IlAsm.Run(String outputFile, String ilSuffix, CpuPlatform cpu) in C:\Users\[...]\Downloads\DllExport-1.4\DllExport-1.4\RGiesecke.DllExport\Parsing\ILAsm.cs:line 118
8>     at RGiesecke.DllExport.Parsing.IlAsm.ReassembleFile(String outputFile, String ilSuffix, CpuPlatform cpu) in C:\Users\[...]\Downloads\DllExport-1.4\DllExport-1.4\RGiesecke.DllExport\Parsing\ILAsm.cs:line 80
8>     at RGiesecke.DllExport.DllExportWeaver.reassembleFile(IlAsm ilAsm, String outputFile, String ilSuffix, CpuPlatform cpu) in C:\Users\[...]\Downloads\DllExport-1.4\DllExport-1.4\RGiesecke.DllExport\DllExportWeaver.cs:line 196
8>     at RGiesecke.DllExport.DllExportWeaver.RunIlAsm(IlAsm ilAsm) in C:\Users\[...]\Downloads\DllExport-1.4\DllExport-1.4\RGiesecke.DllExport\DllExportWeaver.cs:line 147
8>     at RGiesecke.DllExport.DllExportWeaver.Run() in C:\Users\[...]\Downloads\DllExport-1.4\DllExport-1.4\RGiesecke.DllExport\DllExportWeaver.cs:line 87
8>     at RGiesecke.DllExport.MSBuild.ExportTaskImplementation`1.Execute() in C:\Users\[...]\Downloads\DllExport-1.4\DllExport-1.4\RGiesecke.DllExport.MSBuild\RGiesecke.DllExport.MSBuild\ExportTaskImplementation.cs:line 415 (TaskId:101)
8>Done executing task "DllExportAppDomainIsolatedTask" -- FAILED. (TaskId:101)
8>Done building target "DllExportMod" in project "VCI_Comm_PlaybackNode.csproj" -- FAILED.: (TargetId:172)
8>

I have tried both DLLExport v.1.2.7 and 1.4.0. Same issue with both.
I have also tried multiple versions of Fody. No difference.

A snippet from the generated .il file:

.class private auto ansi beforefieldinit 'VCI_Comm_PlaybackNode'.'ConfigManager'
       extends ['mscorlib']'System'.'Object'
{
  .field private class 'VCI_Comm_PlaybackNode.NodeConfig'.'CustomProperties' '_custProp'
  .field private class 'VCI_Comm_PlaybackNode.NodeConfig'.'CustomProperties' '<Config>k__BackingField'
  .custom instance void ['mscorlib']'System.Diagnostics'.'DebuggerBrowsableAttribute'::.ctor(valuetype ['mscorlib']'System.Diagnostics'.'DebuggerBrowsableState') = ( 01 00 00 00 00 00 00 00 ) 
  .custom instance void ['mscorlib']'System.Runtime.CompilerServices'.'CompilerGeneratedAttribute'::.ctor() = ( 01 00 00 00 ) 
  .method public hidebysig instance bool 
          'SetupConfig'(uint32 'sessionID',
                        string 'xmlConfig') cil managed
  {
    // Code size       106 (0x6a)
    .maxstack  3
    .locals init ([0] string 'key',
             [1] class ['System.Xml']'System.Xml.Serialization'.'XmlSerializer' 'serializer',
             [2] class ['mscorlib']'System.IO'.'StringReader' 'stream',
             [3] class ['System.Xml']'System.Xml'.'XmlReader' 'reader',
             [4] bool )
    .line 17,17 : 9,10 'C:\\Projects\\VCI_Project\\trunk\\VCI_Comm_Win\\VCI_Comm_PlaybackNode\\ConfigManager.cs'
    IL_0000:  nop
    .line 18,18 : 13,44 ''
    IL_0001:  ldarga.s   'sessionID'
    IL_0003:  call       instance string ['mscorlib']'System'.'UInt32'::'ToString'()
    IL_0008:  stloc.0
    .line 19,19 : 13,74 ''
    IL_0009:  ldtoken    'VCI_Comm_PlaybackNode.NodeConfig'.'CustomProperties'
    IL_000e:  call       class ['mscorlib']'System'.'Type' ['mscorlib']'System'.'Type'::'GetTypeFromHandle'(valuetype ['mscorlib']'System'.'RuntimeTypeHandle')
    IL_0013:  newobj     instance void ['System.Xml']'System.Xml.Serialization'.'XmlSerializer'::.ctor(class ['mscorlib']'System'.'Type')
    IL_0018:  stloc.1
    .line 21,21 : 20,60 ''
    IL_0019:  ldarg.2
    IL_001a:  newobj     instance void ['mscorlib']'System.IO'.'StringReader'::.ctor(string)
    IL_001f:  stloc.2
    .line 22,22 : 20,57 ''
    .try
    {
      IL_0020:  ldloc.2
      IL_0021:  call       class ['System.Xml']'System.Xml'.'XmlReader' ['System.Xml']'System.Xml'.'XmlReader'::'Create'(class ['mscorlib']'System.IO'.'TextReader')
      IL_0026:  stloc.3
      .line 23,23 : 13,14 ''
      .try
      {
        IL_0027:  nop
        .line 24,24 : 17,79 ''
        IL_0028:  ldarg.0
        IL_0029:  ldloc.1
        IL_002a:  ldloc.3
        IL_002b:  callvirt   instance object ['System.Xml']'System.Xml.Serialization'.'XmlSerializer'::'Deserialize'(class ['System.Xml']'System.Xml'.'XmlReader')
        IL_0030:  castclass  'VCI_Comm_PlaybackNode.NodeConfig'.'CustomProperties'
        IL_0035:  stfld      class 'VCI_Comm_PlaybackNode.NodeConfig'.'CustomProperties' 'VCI_Comm_PlaybackNode'.'ConfigManager'::'_custProp'
        .line 25,25 : 13,14 ''
        IL_003a:  nop
        IL_003b:  leave.s    IL_0048

        .line 16707566,16707566 : 0,0 ''
      }  // end .try
      finally
      {
        IL_003d:  ldloc.3
        IL_003e:  brfalse.s  IL_0047

        IL_0040:  ldloc.3
        IL_0041:  callvirt   instance void ['mscorlib']'System'.'IDisposable'::'Dispose'()
        IL_0046:  nop
        IL_0047:  endfinally
        .line 16707566,16707566 : 0,0 ''
      }  // end handler
      IL_0048:  leave.s    IL_0055

      .line 16707566,16707566 : 0,0 ''
    }  // end .try
    finally
    {
      IL_004a:  ldloc.2
      IL_004b:  brfalse.s  IL_0054

      IL_004d:  ldloc.2
      IL_004e:  callvirt   instance void ['mscorlib']'System'.'IDisposable'::'Dispose'()
      IL_0053:  nop
      IL_0054:  endfinally
      .line 27,27 : 13,32 ''
    }  // end handler
    IL_0055:  ldarg.0
    IL_0056:  ldarg.0
    IL_0057:  ldfld      class 'VCI_Comm_PlaybackNode.NodeConfig'.'CustomProperties' 'VCI_Comm_PlaybackNode'.'ConfigManager'::'_custProp'
    IL_005c:  call       instance void 'VCI_Comm_PlaybackNode'.'ConfigManager'::'set_Config'(class 'VCI_Comm_PlaybackNode.NodeConfig'.'CustomProperties')
    IL_0061:  nop
    .line 29,29 : 13,25 ''
    IL_0062:  ldc.i4.1
    IL_0063:  stloc.s    
    IL_0065:  br.s       IL_0067

    .line 30,30 : 9,10 ''
    IL_0067:  ldloc.s    
    IL_0069:  ret
  } // end of method 'ConfigManager'::'SetupConfig'

The source code of the function that fails looks like this:


    internal class ConfigManager
    {
        private CustomProperties _custProp;

        public bool SetupConfig(uint sessionID, string xmlConfig)
        {
            var key = sessionID.ToString();
            var serializer = new XmlSerializer(typeof(CustomProperties));

            using (var stream = new StringReader(xmlConfig))
            using (var reader = XmlReader.Create(stream))
            {
                _custProp = (CustomProperties) serializer.Deserialize(reader);
            }

            Config = _custProp;

            return true;
        }

        public CustomProperties Config { get; set; }
    }

The failing line is "return true;" if I read the output correctly.

Best Regards
Oscar

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0