Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Embed source files that do not belong to the git repo #115

Open
AArnott opened this issue Nov 18, 2016 · 10 comments
Open

Embed source files that do not belong to the git repo #115

AArnott opened this issue Nov 18, 2016 · 10 comments

Comments

@AArnott
Copy link
Contributor

AArnott commented Nov 18, 2016

When the build itself generates code, that code won't be in the git repo but may still be valuable to step through. This code can be embedded in the PDB such that (a future version of) the VS debugger can display it.

@tmat: any pointers to docs on how we can add sources files to the PDB?

Project owners: I'm willing to fix this.

@tmat
Copy link

tmat commented Nov 18, 2016

csc task/command line:

 /embed                    Embed all source files in the PDB.
 /embed:<file list>        Embed specfic files the PDB

@AArnott
Copy link
Contributor Author

AArnott commented Nov 19, 2016

@nguerrera

@AArnott
Copy link
Contributor Author

AArnott commented Nov 21, 2016

@tmat that switch approach works if your code generators participate and prepare the msbuild items before the compiler is invoked. Does the Csc task accept a parameter for this, and do the msbuild C# targets pass that parameter in from an item list already?

For the person building the PDB, I guess post-compilation adding source files to it is possible, but perhaps we can settle on unadvisable if there is a preferred path which is the above approach. But I'd love to learn how to do that.

@AArnott
Copy link
Contributor Author

AArnott commented Nov 21, 2016

Also, what is this /sourcelink: switch I see? I can't find docs on it. Does it obsolete post-compilation PDB tools such as this one?

@nguerrera
Copy link

@(EmbeddedFiles) get passed to /embed

@tmat
Copy link

tmat commented Nov 21, 2016

@AArnott Yes, it does. dotnet/roslyn#12759

@nguerrera
Copy link

Just pointing out again (see also dotnet/roslyn#15256 (comment)) that /embed is currently only supported if the pdb being produced is portable.

The design for embedded source accounted for Windows PDBs as well, but due to some funding changes, the testing was not completed for VS 2017 RC. Getting it to work with Windows PDBs is tracked by dotnet/roslyn#13707, which is pushed out passed VS 2017 RTM.

dotnet/roslyn#13138 has a code complete implementation of /embed working for Windows PDBs if you want to play with it sooner.

@AArnott
Copy link
Contributor Author

AArnott commented Nov 22, 2016

/embed is currently only supported if the pdb being produced is portable.

Can you educate me on the downside to that? What prevents everyone from compiling portable pdb's? Is it that only certain debuggers support them? Which ones?

@GeertvanHorrik
Copy link
Contributor

A bit late to join the party, but this is for after the changes by @AArnott , right?

@AArnott
Copy link
Contributor Author

AArnott commented Nov 23, 2016

That's how I'm seeing it, yes.
And in fact, the way the discussion is going, it may not really be a gitlink 'feature'. Rather, simply emitting warnings for files that aren't in the git repo with a recommendation that they arrange to add their generated files to the @(EmbeddedFiles) item list.

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

No branches or pull requests

4 participants