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

Fixed: SymWriter COM object is not released on exception #955

Merged

Commits on Jul 19, 2024

  1. Fixed: SymWriter COM object is not released on exception

    The Problem:
    
    Problem observed when being used in coverlet:
    coverlet-coverage/coverlet#1471
    If an exception caused `NativePdbWriter.Write` to never be
    called, it would not call `SymWriter.Close`,
    which in turn meant `Marshal.ReleaseComObject` was left uncalled.
    
    The garbage collector will eventually destroy the object
    and thereby release the COM object, but that happens non-deterministically.
    The COM object is holding to a file handle, which prevents
    other operations on the written file until it is released.
    The result was random file access issues.
    
    The Solution:
    
    Luckily NativePdbWriter is IDisposable. I added a call to
    `writer.Close` there. But now it could be called twice,
    so I had to add a boolean to SymWriter to avoid releasing
    everything twice.
    OskiKervinen-MF committed Jul 19, 2024
    Configuration menu
    Copy the full SHA
    cb94cd9 View commit details
    Browse the repository at this point in the history

Commits on Sep 25, 2024

  1. Code style

    jbevain authored Sep 25, 2024
    Configuration menu
    Copy the full SHA
    663532b View commit details
    Browse the repository at this point in the history