Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DllExportOurILAsm causes project to always appear dirty and require build #206

Open
nitz opened this issue Mar 2, 2022 · 4 comments
Open
Labels

Comments

@nitz
Copy link

nitz commented Mar 2, 2022

Steps to reproduce:

  • Download attached solution, extract, open.
  • Issue build solution command to get fresh builds of all projects.
  • Issue build solution command again, observe behavior.
  • DllExport -version: v1.7.4.29858+c1cc52f
  • Used Visual Studio / MSBuild: MSVS 17.1.0 / MSBuild 15.9.21+g9802d43bc3

Information from Data tab for LibFoo:

Installed: True; 1.7.4+c1cc52f; invoked: 1.7.4
Project type: CsSdk
Storage: ProjectFiles
Compiler.Platform: Auto
Compiler.ordinalsBase: 1
Compiler.rSysObj: False
Compiler.ourILAsm: True
Compiler.customILAsm: 
Compiler.genExpLib: False
Compiler.peCheck: PeIl
Compiler.patches: None
PreProc.Type: None
PreProc.Cmd: 
PostProc.Type: None
PostProc.ProcEnv: $(SolutionPath);$(MSBuildThisFileFullPath)
PostProc.Cmd: 
SignAssembly: 
Identifier: B2B68504-BE59-4B4A-8CEA-9C3E3A6C51F6
Instance: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\MSBuild.exe
Project path: C:\Users\cmd\source\repos\AlwaysDirtyIssue\LibFoo\LibFoo.csproj
Action: Configure
PlatformTarget: x64
TargetFramework: netstandard2.0
TargetFrameworks: 
TargetFrameworkVersion: 
RootNamespace: 
AssemblyName: 
MgrArgs: 
MetaLib: tools\raw\lib\net20\DllExport.dll
MetaCor: tools\raw\lib\netstd\DllExport.dll
Proxy: 
StoragePath: .net.dllexport.targets
ddNS: LibFoo
ddNS max buffer: 500
UseCecil: True
intermediateFiles: False
timeout: 30000
Options: None
RootPath: C:\Users\cmd\source\repos\AlwaysDirtyIssue\
PkgPath: C:\Users\cmd\source\repos\AlwaysDirtyIssue\packages\\DllExport.1.7.4\
SlnFile: 
SlnDir: C:\Users\cmd\source\repos\AlwaysDirtyIssue\
DxpTarget: tools\net.r_eg.DllExport.targets
MsgGuiLevel: -1
LockIfError: 

Information from Data tab for LibBar:

Installed: True; 1.7.4+c1cc52f; invoked: 1.7.4
Project type: CsSdk
Storage: ProjectFiles
Compiler.Platform: Auto
Compiler.ordinalsBase: 1
Compiler.rSysObj: False
Compiler.ourILAsm: False
Compiler.customILAsm: 
Compiler.genExpLib: False
Compiler.peCheck: PeIl
Compiler.patches: None
PreProc.Type: None
PreProc.Cmd: 
PostProc.Type: None
PostProc.ProcEnv: $(SolutionPath);$(MSBuildThisFileFullPath)
PostProc.Cmd: 
SignAssembly: 
Identifier: D0933B3C-5336-4CFD-B255-303678C9FCE1
Instance: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\MSBuild.exe
Project path: C:\Users\cmd\source\repos\AlwaysDirtyIssue\LibBar\LibBar.csproj
Action: Configure
PlatformTarget: 
TargetFramework: netstandard2.0
TargetFrameworks: 
TargetFrameworkVersion: 
RootNamespace: 
AssemblyName: 
MgrArgs: 
MetaLib: tools\raw\lib\net20\DllExport.dll
MetaCor: tools\raw\lib\netstd\DllExport.dll
Proxy: 
StoragePath: .net.dllexport.targets
ddNS: LibBar
ddNS max buffer: 500
UseCecil: True
intermediateFiles: False
timeout: 30000
Options: None
RootPath: C:\Users\cmd\source\repos\AlwaysDirtyIssue\
PkgPath: C:\Users\cmd\source\repos\AlwaysDirtyIssue\packages\\DllExport.1.7.4\
SlnFile: 
SlnDir: C:\Users\cmd\source\repos\AlwaysDirtyIssue\
DxpTarget: tools\net.r_eg.DllExport.targets
MsgGuiLevel: -1
LockIfError: 

Project Sample

AlwaysDirtyIssue.zip - Reproduction solution w/3 projects:

  • LibMain: A class library that references the other two libraries. (To show that dirty rebuilds causes cascades.)
  • LibFoo: A class library with DllExports using "ourILAsm".
  • LibBar: A class library with DllExports not using "ourILAsm".

Details

The only difference between LibFoo and LibBar should be the setting of DllExportOurILAsm. When issuing "build solution", LibBar behaves as expected, only building & running build events when changes are made. By comparison, LibFoo invokes a portion of the build process (including post build events, DllExport, etc.) every time.

Comparing the output from msbuild between the two projects, LibFoo's output has only a single line of output that LibBar's doesn't:

Copying file from "<sln dir>\LibFoo\obj\x64\Debug\netstandard2.0\LibFoo.pdb" to "<sln dir>\AlwaysDirtyIssue\LibFoo\bin\x64\Debug\netstandard2.0\LibFoo.pdb".

My guess is that, because DllExport deletes the PDB when using "Our IL Asm" since it isn't valid, msbuild thinks the project needs to build because the expected output file is missing.

If one day "Our IL Asm" ever does re-gain the feature of being able to produce PDBs, this issue would be solved. In the meantime, perhaps there's someway to indicate to msbuild that it shouldn't expect to find the PDB?

Cheers!

@nitz nitz added the bug label Mar 2, 2022
@3F
Copy link
Owner

3F commented Mar 13, 2022

Thanks for the detailed report!

My guess is that, because DllExport deletes the PDB when using "Our IL Asm"

Yes, I remember this logic programmed due to possible incorrect ISymUnmanagedWriter for non-modified asm.
And more like, yes, this can really invalidate some nodes in msbuild -_-

Good catch! Need to check it but I literally don't even know how to live in the coming months at all, thus no ETA. Sorry.

@nitz
Copy link
Author

nitz commented Mar 14, 2022

I literally don't even know how to live in the coming months at all, thus no ETA. Sorry.

No worries; this is just something I wanted to get on the books with details before I forgot, and more than that it's a totally non blocking issue! Life always takes priority. Please take care of yourself!

@crusader-mike
Copy link

crusader-mike commented Sep 5, 2023

@3F Any progress/luck wrt this issue? I just came across it... In fact, for some unknown reason, .pdb file gets deleted in Release build regardless of DllExportOurILAsm value.

@3F
Copy link
Owner

3F commented Sep 20, 2023

@crusader-mike

Any progress/luck wrt this issue?

My luck is gone when my opensource activities was stopped/paused. Yet no opportunity to review the issue somehow, later or not I don't know either. Sorry. But who cares.

for some unknown reason

Above,

Stub was programmed due to ISymUnmanagedWriter because it produces incompatible format anyway
https://github.com/3F/coreclr/blob/05afa4f81fdf671429b54467c64d65cde6b5fadc/src/debug/ildbsymlib/symwrite.cpp#L308
while adding a bunch of other problems together with modified modules at runtime, as far as I remember.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants