dsplaisted / strongnamer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

build fails for obfuscated assembly

crystalgreen opened this issue · comments

This issue can be reproduce by creating a (library) project, adding StrongNamer and the nuget package Oracle.ManagedDataAccess e.g. v19.3.1.
Then the build fails with

1>  Assembly file 'C:\TestProj\packages\Oracle.ManagedDataAccess.19.3.1\lib\net40\Oracle.ManagedDataAccess.dll' failed to load.  Skipping.  System.ArgumentOutOfRangeException: Non-negative number required.
1>  Parameter name: count
1>     at System.IO.BinaryReader.ReadBytes(Int32 count)
1>     at Mono.Cecil.PE.ImageReader.ReadDebugHeader()
1>     at Mono.Cecil.PE.ImageReader.ReadImage()
1>     at Mono.Cecil.PE.ImageReader.ReadImage(Disposable`1 stream, String file_name)
1>     at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
1>     at StrongNamer.AddStrongName.ProcessAssembly(ITaskItem assemblyItem, StrongNameKeyPair key, StrongNamerAssemblyResolver resolver)

The Oracle assembly seems to be obfuscated which causes that issue within the Cecil lib.

I'm not sure where to fix this best: Cecil or StrongNamer. Maybe a workaround here would be easiest:
Allow config of particular assembly references that should be skipped.

This issue was also reported for

Btw, with dotPeek I manage to inspect the Oracle assembly and see in deed some obfuscated code.

The latest mono.cecil code fixes this, however they have not pushed an updated package yet.

Nuget package of mono.cecil is available now. Is it possible to build a new version? We ran into the same problem