Browse Source

Use `FileMode.Create` for output PDB files to ensure existing files are fully overwritten/truncated.

pull/3619/head
sonyps5201314 1 month ago
parent
commit
ef52899b0b
  1. 4
      ILSpy/Commands/GeneratePdbContextMenuEntry.cs

4
ILSpy/Commands/GeneratePdbContextMenuEntry.cs

@ -93,7 +93,7 @@ namespace ICSharpCode.ILSpy @@ -93,7 +93,7 @@ namespace ICSharpCode.ILSpy
AvalonEditTextOutput output = new AvalonEditTextOutput();
Stopwatch stopwatch = Stopwatch.StartNew();
options.CancellationToken = ct;
using (FileStream stream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write))
using (FileStream stream = new FileStream(fileName, FileMode.Create, FileAccess.Write))
{
try
{
@ -180,7 +180,7 @@ namespace ICSharpCode.ILSpy @@ -180,7 +180,7 @@ namespace ICSharpCode.ILSpy
try
{
using (FileStream stream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write))
using (FileStream stream = new FileStream(fileName, FileMode.Create, FileAccess.Write))
{
var decompiler = new CSharpDecompiler(file, assembly.GetAssemblyResolver(options.DecompilerSettings.AutoLoadAssemblyReferences), options.DecompilerSettings);
decompiler.CancellationToken = ct;

Loading…
Cancel
Save