Skip to content

msbuild Publish fails with Error: Invalid directory size. #72425

@vsfeedback

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


[severity:I'm unable to use this version] [regression] [worked-in:16 to 17]
We are switching from VS 2019/.NET 5 to VS 2022/.NET 6 in our projects. Unfortunately, we now get an exception with the publish target. The build target works fine and the application works normally.
When publishing with the following pubxml

Release
x64
..\bin\Release\publish\
FileSystem
net6.0-windows
win-x64
true
False
True
False

you end up in the exception

...
3>--out:"obj\x64\Release\win-x64\R2R\ActiproSoftware.Shared.Wpf.dll"
3>C:\Program Files (x86)\Actipro Software\WPF-Controls\v14.1.0601\Assemblies\ActiproSoftware.Shared.Wpf.dll
3>
3>Error: Invalid directory size.
3>System.BadImageFormatException: Invalid directory size.
3> at System.Reflection.PortableExecutable.PEReader.ReadDebugDirectory()
3> at Internal.TypeSystem.Ecma.PortablePdbSymbolReader.TryOpenEmbedded(PEReader peReader, MetadataStringDecoder stringDecoder)
3> at ILCompiler.CompilerTypeSystemContext.AddModule(String filePath, String expectedSimpleName, Boolean useForBinding, ModuleData oldModuleData)
3> at ILCompiler.CompilerTypeSystemContext.GetOrAddModuleFromPath(String filePath, Boolean useForBinding)
3> at ILCompiler.CompilerTypeSystemContext.GetModuleFromPath(String filePath)
3> at ILCompiler.Program.Run(String[] args)
3> at ILCompiler.Program.Main(String[] args)
3>C:\Users\wolfgang.nuget\packages\microsoft.netcore.app.crossgen2.win-x64\6.0.6\tools\crossgen2.exe --targetos:windows
3>--targetarch:x64
3>-O
...

This old third-party DLL from 2014 is included in the project as a reference

  C:\Program Files (x86)\Actipro Software\WPF-Controls\v14.1.0601\Assemblies\ActiproSoftware.Shared.Wpf.dll

Original Comments

Wolfgang Kordts on 7/9/2022, 01:48 AM:

(private comment, text removed)

Feedback Bot on 7/10/2022, 07:20 PM:

(private comment, text removed)

Wenwen Fan [MSFT] on 7/12/2022, 08:48 PM:

(private comment, text removed)

Wolfgang Kordts on 7/14/2022, 00:47 PM:

(private comment, text removed)

Wenwen Fan [MSFT] on 7/12/2022, 08:48 PM:

(private comment, text removed)

Wenwen Fan [MSFT] on 7/14/2022, 07:51 PM:

(private comment, text removed)


Original Solutions

(no solutions)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions