private EmitOptions GetEmitOptions(DependencyContextCompilationOptions dependencyContextOptions) { // Assume we're always producing pdbs unless DebugType = none _emitPdb = true; DebugInformationFormat debugInformationFormat; if (string.IsNullOrEmpty(dependencyContextOptions.DebugType)) { debugInformationFormat = SymbolsUtility.SupportsFullPdbGeneration() ? DebugInformationFormat.Pdb : DebugInformationFormat.PortablePdb; } else { // Based on https://github.com/dotnet/roslyn/blob/1d28ff9ba248b332de3c84d23194a1d7bde07e4d/src/Compilers/CSharp/Portable/CommandLine/CSharpCommandLineParser.cs#L624-L640 switch (dependencyContextOptions.DebugType.ToLower()) { case "none": // There isn't a way to represent none in DebugInformationFormat. // We'll set EmitPdb to false and let callers handle it by setting a null pdb-stream. _emitPdb = false; return(new EmitOptions()); case "portable": debugInformationFormat = DebugInformationFormat.PortablePdb; break; case "embedded": // Roslyn does not expose enough public APIs to produce a binary with embedded pdbs. // We'll produce PortablePdb instead to continue providing a reasonable user experience. debugInformationFormat = DebugInformationFormat.PortablePdb; break; case "full": case "pdbonly": debugInformationFormat = SymbolsUtility.SupportsFullPdbGeneration() ? DebugInformationFormat.Pdb : DebugInformationFormat.PortablePdb; break; default: throw new InvalidOperationException(Resources.FormatUnsupportedDebugInformationFormat(dependencyContextOptions.DebugType)); } } var emitOptions = new EmitOptions(debugInformationFormat: debugInformationFormat); return(emitOptions); }
private EmitOptions GetEmitOptions(DependencyContextCompilationOptions dependencyContextOptions) { DebugInformationFormat debugInformationFormat; if (string.IsNullOrEmpty(dependencyContextOptions.DebugType)) { debugInformationFormat = SymbolsUtility.SupportsFullPdbGeneration() ? DebugInformationFormat.Pdb : DebugInformationFormat.PortablePdb; } else { // Based on https://github.com/dotnet/roslyn/blob/1d28ff9ba248b332de3c84d23194a1d7bde07e4d/src/Compilers/CSharp/Portable/CommandLine/CSharpCommandLineParser.cs#L624-L640 switch (dependencyContextOptions.DebugType.ToLower()) { case "portable": debugInformationFormat = DebugInformationFormat.PortablePdb; break; case "embedded": debugInformationFormat = DebugInformationFormat.Embedded; break; case "full": case "pdbonly": debugInformationFormat = SymbolsUtility.SupportsFullPdbGeneration() ? DebugInformationFormat.Pdb : DebugInformationFormat.PortablePdb; break; default: throw new InvalidOperationException(Resources.FormatUnsupportedDebugInformationFormat(dependencyContextOptions.DebugType)); } } var emitOptions = new EmitOptions(debugInformationFormat: debugInformationFormat); return(emitOptions); }