0
votes

I have bolded a line at the end of exception which states where the project originated from. Binaries are copied over to a network share. When exception occurs I would expect that it points to the network share file location, however, points to a local build. How could I modify this info?

Could not write : System.IO.FileFormatException: File contains corrupted data. at MS.Internal.IO.Zip.ZipIOEndOfCentralDirectoryBlock.FindPosition(Stream archiveStream) at MS.Internal.IO.Zip.ZipIOEndOfCentralDirectoryBlock.SeekableLoad(ZipIOBlockManager blockManager) at MS.Internal.IO.Zip.ZipArchive..ctor(Stream archiveStream, FileMode mode, FileAccess access, Boolean streaming, Boolean ownStream) at MS.Internal.IO.Zip.ZipArchive.OpenOnFile(String path, FileMode mode, FileAccess access, FileShare share, Boolean streaming) at System.IO.Packaging.ZipPackage..ctor(String path, FileMode mode, FileAccess access, FileShare share, Boolean streaming) at System.IO.Packaging.Package.Open(String path, FileMode packageMode, FileAccess packageAccess, FileShare packageShare, Boolean streaming)
at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.OpenCore(String path, Boolean readWriteMode) at DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Open(String path, Boolean isEditable, OpenSettings openSettings) at DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Open(String path, Boolean isEditable) at AuthorizationForSSAS.ExcelDocument.ChangeConnectionStrings(IReportConfig repConfig) in C:\foo\bar\1.0.0.5\Solution\Project\Class.cs:line 26

2
This is not a path to the binary, this is the path to the source file at build time. - Eduard Malakhov
Ok, so if I would have it on build server, it would show the source path of the build server? Feel like in my specific case it is misleading because I build it on a local machine. - Janis S.
Yes, it is always the path on the machine where the binary was built. And there is no way of changing it AFAIK. Moreover, I can't think of a use case when changing it would be necessary. - Eduard Malakhov

2 Answers

2
votes

Source file paths are stored in the .pdb. Certain transforms are possible but it's not intended that they be updated for the deployment location. Their intended use is so that you, as someone receiving an error report, know which file you want to look in. So, if you're a sole developer and working locally, you'd want it to be the local path.

Depending on your Source Control, build and packaging systems and requirements, you might want to look into Source Indexing - this associates the specific revisions that were pulled from source control during the build. But this is typically done to make debugging easier later.

E.g. here's the help for Index Sources & Publish Symbols if you're using TFS Build.

0
votes

There is no way. This is system exception, stack trace compound automaticaly. If file local - it will be local, even if you copied it from somewhere.