strongnamer icon indicating copy to clipboard operation
strongnamer copied to clipboard

build fails for obfuscated assembly

Open crystalgreen opened this issue 6 years ago • 2 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.

crystalgreen avatar Jul 18 '19 09:07 crystalgreen

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

mcnallys avatar Aug 16 '19 14:08 mcnallys

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

PavelReichl avatar Oct 14 '19 06:10 PavelReichl