-
Notifications
You must be signed in to change notification settings - Fork 754
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
Special case Disposing DotNetObjectReferences #2176
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,6 @@ public static partial class DotNetDispatcher | |
public static void BeginInvoke(string callId, string assemblyName, string methodIdentifier, long dotNetObjectId, string argsJson) { } | ||
public static void EndInvoke(string arguments) { } | ||
public static string Invoke(string assemblyName, string methodIdentifier, long dotNetObjectId, string argsJson) { throw null; } | ||
[Microsoft.JSInterop.JSInvokableAttribute("DotNetDispatcher.ReleaseDotNetObject")] | ||
public static void ReleaseDotNetObject(long dotNetObjectId) { } | ||
} | ||
public static partial class DotNetObjectRef | ||
{ | ||
|
@@ -18,7 +16,7 @@ public static partial class DotNetObjectRef | |
public sealed partial class DotNetObjectRef<TValue> : System.IDisposable where TValue : class | ||
{ | ||
internal DotNetObjectRef() { } | ||
public TValue Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😲 |
||
public TValue Value { get { throw null; } } | ||
public void Dispose() { } | ||
} | ||
public partial interface IJSInProcessRuntime : Microsoft.JSInterop.IJSRuntime | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,7 @@ public static class DotNetObjectRef | |
/// <returns>An instance of <see cref="DotNetObjectRef{TValue}" />.</returns> | ||
public static DotNetObjectRef<TValue> Create<TValue>(TValue value) where TValue : class | ||
{ | ||
var objectId = DotNetObjectRefManager.Current.TrackObject(value); | ||
return new DotNetObjectRef<TValue>(objectId, value); | ||
return new DotNetObjectRef<TValue>(DotNetObjectRefManager.Current, value); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this going to fight with your other change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup. But it's easier to review these things piecemeal. |
||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,6 @@ namespace Microsoft.JSInterop | |
{ | ||
internal interface IDotNetObjectRef : IDisposable | ||
{ | ||
object Value { get; } | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just hardening? Or was there a bug here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just hardening. I was confused looking at the function name, because I assumed it only called
instance
methods.