-
Notifications
You must be signed in to change notification settings - Fork 985
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The existing GetData methods now call the new ones. TryGetData method…
…s will fall back to use BinaryFormatter if a binder is provided. The GetData methods will use a binder that allows BInaryFormater to resolve all types is the application sets EnableUnsafeBinaryFormatterDeserialization AppContext switch to true, by default this switch is false.
- Loading branch information
1 parent
e462a84
commit 816f4c9
Showing
24 changed files
with
1,257 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/Common/tests/TestUtilities/BinaryFormatterInClipboardScope.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System; | ||
|
||
public readonly ref struct BinaryFormatterInClipboardScope | ||
{ | ||
private readonly AppContextSwitchScope _switchScope; | ||
|
||
public BinaryFormatterInClipboardScope(bool enable) | ||
{ | ||
Monitor.Enter(typeof(BinaryFormatterInClipboardScope)); | ||
_switchScope = new(AppContextSwitchNames.ClipboardEnableUnsafeBinaryFormatterDeserializationSwitchName, enable); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
try | ||
{ | ||
_switchScope.Dispose(); | ||
} | ||
finally | ||
{ | ||
Monitor.Exit(typeof(BinaryFormatterInClipboardScope)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Microsoft.VisualBasic.MyServices.ClipboardProxy.SetDataAsJson(Of T)(data As T) -> Void | ||
Microsoft.VisualBasic.MyServices.ClipboardProxy.TryGetData(Of T)(ByRef data As T) -> Boolean | ||
Microsoft.VisualBasic.MyServices.ClipboardProxy.TryGetData(Of T)(format As String, ByRef data As T) -> Boolean | ||
Microsoft.VisualBasic.MyServices.ClipboardProxy.TryGetData(Of T)(format As String, resolver As System.Func(Of System.Reflection.Metadata.TypeName, System.Type), ByRef data As T) -> Boolean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.