Skip to content

Taking a WeakReference to a C# object that inherits a native WinRT object crashes the app. #1025

@jlaanstra

Description

@jlaanstra

Describe the bug
WeakReferences to managed objects inheriting native objects causes InvalidCastExceptions and/or access violations.

To Reproduce

  1. Open the attached project in VS: WeakRefRepro.zip
  2. Click "Click Me" repeatedly.

Expected behavior
No crash/exception.

Version Info
CsWinRT 1.3.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions