Skip to content

Commit

Permalink
Obsolete 'GetRef()' method
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Oct 28, 2024
1 parent 4d9b418 commit cfebdfe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/WinRT.Runtime/MatchingRefApiCompatBaseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -285,4 +285,7 @@ MembersMustExist : Member 'protected void WinRT.IObjectReference.ThrowIfDisposed
MembersMustExist : Member 'public System.Boolean WinRT.IObjectReference.TryAddRefUnsafe()' does not exist in the reference but it does exist in the implementation.
MembersMustExist : Member 'public System.IntPtr WinRT.IObjectReference.GetThisPtr()' does not exist in the reference but it does exist in the implementation.
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'WinRT.IObjectReference.Release()' in the implementation but not the reference.
Total Issues: 286
CannotRemoveAttribute : Attribute 'System.ComponentModel.EditorBrowsableAttribute' exists on 'WinRT.IObjectReference.GetRef()' in the implementation but not the reference.
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'WinRT.IObjectReference.GetRef()' in the implementation but not the reference.
CannotRemoveAttribute : Attribute 'System.ComponentModel.EditorBrowsableAttribute' exists on 'WinRT.IObjectReference.Release()' in the implementation but not the reference.
Total Issues: 289
5 changes: 4 additions & 1 deletion src/WinRT.Runtime/ObjectReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ static bool TryCreateRcwFallback(IObjectReference objectReference, out object rc
throw new InvalidOperationException($"Target type '{typeof(T)}' is not a projected type.");
}

[Obsolete("This method is not safe. Use 'GetThisPtr()' instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public IntPtr GetRef()
{
ThrowIfDisposedUnsafe();
Expand All @@ -298,7 +300,8 @@ public IntPtr GetRef()
}

/// <inheritdoc cref="NativeReleaseUnsafe"/>
[Obsolete("This method is obsoleted and should not be used. Use 'Dispose()' instead.")]
[Obsolete("This method is not safe. Use 'Dispose()' instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
protected virtual unsafe void Release()
{
NativeReleaseUnsafe();
Expand Down

0 comments on commit cfebdfe

Please sign in to comment.