Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
ee1cf15c
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
ee1cf15c
编写于
1月 08, 2020
作者:
T
Tomáš Matoušek
提交者:
GitHub
1月 08, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove Dispose(disposing) from objects without finalization (#40782)
上级
d25991bb
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
40 addition
and
102 deletion
+40
-102
src/EditorFeatures/Test/Diagnostics/DiagnosticDataSerializerTests.cs
...eatures/Test/Diagnostics/DiagnosticDataSerializerTests.cs
+1
-6
src/EditorFeatures/TestUtilities/Remote/InProcRemostHostClient.cs
...orFeatures/TestUtilities/Remote/InProcRemostHostClient.cs
+2
-2
src/VisualStudio/Core/Def/Implementation/ProjectSystem/RunningDocumentTableEventTracker.cs
...ntation/ProjectSystem/RunningDocumentTableEventTracker.cs
+8
-16
src/VisualStudio/Core/Def/Implementation/Remote/JsonRpcConnection.cs
...tudio/Core/Def/Implementation/Remote/JsonRpcConnection.cs
+6
-9
src/VisualStudio/Core/Def/Implementation/Remote/ServiceHubRemoteHostClient.PooledConnection.cs
...ion/Remote/ServiceHubRemoteHostClient.PooledConnection.cs
+3
-7
src/VisualStudio/Core/Def/Implementation/Remote/ServiceHubRemoteHostClient.cs
...e/Def/Implementation/Remote/ServiceHubRemoteHostClient.cs
+2
-2
src/VisualStudio/Core/Test.Next/Services/VisualStudioDiagnosticAnalyzerExecutorTests.cs
...t/Services/VisualStudioDiagnosticAnalyzerExecutorTests.cs
+1
-10
src/VisualStudio/IntegrationTest/IntegrationTests/AbstractIntegrationTest.cs
...tegrationTest/IntegrationTests/AbstractIntegrationTest.cs
+5
-15
src/VisualStudio/IntegrationTest/TestUtilities/Harness/MessageFilter.cs
...io/IntegrationTest/TestUtilities/Harness/MessageFilter.cs
+6
-15
src/Workspaces/Core/Portable/Remote/RemoteHostClient.cs
src/Workspaces/Core/Portable/Remote/RemoteHostClient.cs
+3
-8
src/Workspaces/Core/Portable/TemporaryStorage/TemporaryStorageServiceFactory.MemoryMappedInfo.cs
...torage/TemporaryStorageServiceFactory.MemoryMappedInfo.cs
+3
-12
未找到文件。
src/EditorFeatures/Test/Diagnostics/DiagnosticDataSerializerTests.cs
浏览文件 @
ee1cf15c
...
...
@@ -343,14 +343,9 @@ public Task<bool> WriteStreamAsync(Document document, string name, Stream stream
return
SpecializedTasks
.
True
;
}
p
rotected
virtual
void
Dispose
(
bool
disposing
)
p
ublic
virtual
void
Dispose
(
)
{
}
public
void
Dispose
()
{
Dispose
(
true
);
}
}
}
}
...
...
src/EditorFeatures/TestUtilities/Remote/InProcRemostHostClient.cs
浏览文件 @
ee1cf15c
...
...
@@ -103,14 +103,14 @@ protected override void OnStarted()
{
}
p
rotected
override
void
Dispose
(
bool
disposing
)
p
ublic
override
void
Dispose
(
)
{
// we are asked to disconnect. unsubscribe and dispose to disconnect
_endPoint
.
Disconnected
-=
OnDisconnected
;
_endPoint
.
Dispose
();
_remotableDataRpc
.
Dispose
();
base
.
Dispose
(
disposing
);
base
.
Dispose
();
}
private
void
OnDisconnected
(
JsonRpcDisconnectedEventArgs
e
)
...
...
src/VisualStudio/Core/Def/Implementation/ProjectSystem/RunningDocumentTableEventTracker.cs
浏览文件 @
ee1cf15c
...
...
@@ -236,26 +236,18 @@ private bool TryGetBuffer(uint docCookie, out ITextBuffer textBuffer)
return
false
;
}
#
region
IDisposable
Support
private
void
Dispose
(
bool
disposing
)
{
if
(!
_isDisposed
)
public
void
Dispose
()
{
if
(
disposing
)
if
(
_isDisposed
)
{
return
;
}
var
runningDocumentTableForEvents
=
(
IVsRunningDocumentTable
)
_runningDocumentTable
;
runningDocumentTableForEvents
.
UnadviseRunningDocTableEvents
(
_runningDocumentTableEventsCookie
);
_runningDocumentTableEventsCookie
=
0
;
}
_isDisposed
=
true
;
}
}
public
void
Dispose
()
{
Dispose
(
true
);
}
#
endregion
}
}
src/VisualStudio/Core/Def/Implementation/Remote/JsonRpcConnection.cs
浏览文件 @
ee1cf15c
...
...
@@ -52,17 +52,14 @@ public override Task<T> InvokeAsync<T>(string targetName, IReadOnlyList<object>
public
override
Task
<
T
>
InvokeAsync
<
T
>(
string
targetName
,
IReadOnlyList
<
object
>
arguments
,
Func
<
Stream
,
CancellationToken
,
Task
<
T
>>
directStreamReader
,
CancellationToken
cancellationToken
)
=>
_serviceEndPoint
.
InvokeAsync
(
targetName
,
arguments
,
directStreamReader
,
cancellationToken
);
protected
override
void
Dispose
(
bool
disposing
)
{
if
(
disposing
)
protected
override
void
DisposeImpl
()
{
// dispose service and snapshot channels
_serviceEndPoint
.
UnexpectedExceptionThrown
-=
UnexpectedExceptionThrown
;
_serviceEndPoint
.
Dispose
();
_remoteDataRpc
.
Dispose
();
}
base
.
Dispose
(
disposing
);
base
.
Dispose
Impl
(
);
}
}
}
src/VisualStudio/Core/Def/Implementation/Remote/ServiceHubRemoteHostClient.PooledConnection.cs
浏览文件 @
ee1cf15c
...
...
@@ -35,14 +35,10 @@ public override Task<T> InvokeAsync<T>(string targetName, IReadOnlyList<object>
public
override
Task
<
T
>
InvokeAsync
<
T
>(
string
targetName
,
IReadOnlyList
<
object
>
arguments
,
Func
<
Stream
,
CancellationToken
,
Task
<
T
>>
directStreamReader
,
CancellationToken
cancellationToken
)
=>
_connection
.
InvokeAsync
(
targetName
,
arguments
,
directStreamReader
,
cancellationToken
);
protected
override
void
Dispose
(
bool
disposing
)
{
if
(
disposing
)
protected
override
void
DisposeImpl
()
{
_connectionManager
.
Free
(
_serviceName
,
_connection
);
}
base
.
Dispose
(
disposing
);
base
.
DisposeImpl
();
}
}
}
...
...
src/VisualStudio/Core/Def/Implementation/Remote/ServiceHubRemoteHostClient.cs
浏览文件 @
ee1cf15c
...
...
@@ -169,7 +169,7 @@ protected override void OnStarted()
RegisterGlobalOperationNotifications
();
}
p
rotected
override
void
Dispose
(
bool
disposing
)
p
ublic
override
void
Dispose
(
)
{
// cancel all pending async work
_shutdownCancellationTokenSource
.
Cancel
();
...
...
@@ -187,7 +187,7 @@ protected override void Dispose(bool disposing)
_connectionManager
.
Dispose
();
base
.
Dispose
(
disposing
);
base
.
Dispose
();
}
public
HostGroup
HostGroup
...
...
src/VisualStudio/Core/Test.Next/Services/VisualStudioDiagnosticAnalyzerExecutorTests.cs
浏览文件 @
ee1cf15c
...
...
@@ -333,12 +333,10 @@ public MyUpdateSource(Workspace workspace)
public
override
Workspace
Workspace
=>
_workspace
;
}
private
class
InvokeThrowsCancellationConnection
:
RemoteHostClient
.
Connection
private
sealed
class
InvokeThrowsCancellationConnection
:
RemoteHostClient
.
Connection
{
private
readonly
CancellationTokenSource
_source
;
public
bool
Disposed
=
false
;
public
InvokeThrowsCancellationConnection
(
CancellationTokenSource
source
)
{
_source
=
source
;
...
...
@@ -360,13 +358,6 @@ public override Task InvokeAsync(string targetName, IReadOnlyList<object> argume
public
override
Task
<
T
>
InvokeAsync
<
T
>(
string
targetName
,
IReadOnlyList
<
object
>
arguments
,
Func
<
Stream
,
CancellationToken
,
Task
<
T
>>
funcWithDirectStreamAsync
,
CancellationToken
cancellationToken
)
=>
throw
new
NotImplementedException
();
protected
override
void
Dispose
(
bool
disposing
)
{
base
.
Dispose
(
disposing
);
Disposed
=
true
;
}
}
}
}
src/VisualStudio/IntegrationTest/IntegrationTests/AbstractIntegrationTest.cs
浏览文件 @
ee1cf15c
...
...
@@ -77,12 +77,6 @@ public virtual Task DisposeAsync()
return
Task
.
CompletedTask
;
}
public
void
Dispose
()
{
Dispose
(
true
);
GC
.
SuppressFinalize
(
this
);
}
protected
virtual
MessageFilter
RegisterMessageFilter
()
=>
new
MessageFilter
();
...
...
@@ -93,18 +87,14 @@ protected void Wait(double seconds)
}
/// <summary>
/// This method provides the implementation for <see cref="IDisposable.Dispose"/>. This method via the
/// <see cref="IDisposable"/> interface (i.e. <paramref name="disposing"/> is <see langword="true"/>) if the
/// constructor completes successfully. The <see cref="InitializeAsync"/> may or may not have completed
/// successfully.
/// This method provides the implementation for <see cref="IDisposable.Dispose"/>.
/// This method is called via the <see cref="IDisposable"/> interface if the constructor completes successfully.
/// The <see cref="InitializeAsync"/> may or may not have completed successfully.
/// </summary>
protected
virtual
void
Dispose
(
bool
disposing
)
{
if
(
disposing
)
public
virtual
void
Dispose
()
{
_messageFilter
.
Dispose
();
}
}
protected
KeyPress
Ctrl
(
VirtualKey
virtualKey
)
=>
new
KeyPress
(
virtualKey
,
ShiftState
.
Ctrl
);
...
...
src/VisualStudio/IntegrationTest/TestUtilities/Harness/MessageFilter.cs
浏览文件 @
ee1cf15c
...
...
@@ -8,9 +8,9 @@
namespace
Microsoft.VisualStudio.IntegrationTest.Utilities.Harness
{
public
class
MessageFilter
:
IMessageFilter
,
IDisposable
public
sealed
class
MessageFilter
:
IMessageFilter
,
IDisposable
{
pr
otected
const
uint
CancelCall
=
~
0U
;
pr
ivate
const
uint
CancelCall
=
~
0U
;
private
readonly
MessageFilterSafeHandle
_messageFilterRegistration
;
private
readonly
TimeSpan
_timeout
;
...
...
@@ -28,12 +28,12 @@ public MessageFilter(TimeSpan timeout, TimeSpan retryDelay)
_messageFilterRegistration
=
MessageFilterSafeHandle
.
Register
(
this
);
}
public
virtual
uint
HandleInComingCall
(
uint
dwCallType
,
IntPtr
htaskCaller
,
uint
dwTickCount
,
INTERFACEINFO
[]
lpInterfaceInfo
)
public
uint
HandleInComingCall
(
uint
dwCallType
,
IntPtr
htaskCaller
,
uint
dwTickCount
,
INTERFACEINFO
[]
lpInterfaceInfo
)
{
return
(
uint
)
SERVERCALL
.
SERVERCALL_ISHANDLED
;
}
public
virtual
uint
RetryRejectedCall
(
IntPtr
htaskCallee
,
uint
dwTickCount
,
uint
dwRejectType
)
public
uint
RetryRejectedCall
(
IntPtr
htaskCallee
,
uint
dwTickCount
,
uint
dwRejectType
)
{
if
((
SERVERCALL
)
dwRejectType
!=
SERVERCALL
.
SERVERCALL_RETRYLATER
&&
(
SERVERCALL
)
dwRejectType
!=
SERVERCALL
.
SERVERCALL_REJECTED
)
...
...
@@ -49,23 +49,14 @@ public virtual uint RetryRejectedCall(IntPtr htaskCallee, uint dwTickCount, uint
return
(
uint
)
_retryDelay
.
TotalMilliseconds
;
}
public
virtual
uint
MessagePending
(
IntPtr
htaskCallee
,
uint
dwTickCount
,
uint
dwPendingType
)
public
uint
MessagePending
(
IntPtr
htaskCallee
,
uint
dwTickCount
,
uint
dwPendingType
)
{
return
(
uint
)
PENDINGMSG
.
PENDINGMSG_WAITDEFPROCESS
;
}
protected
virtual
void
Dispose
(
bool
disposing
)
{
if
(
disposing
)
{
_messageFilterRegistration
.
Dispose
();
}
}
public
void
Dispose
()
{
Dispose
(
true
);
GC
.
SuppressFinalize
(
this
);
_messageFilterRegistration
.
Dispose
();
}
}
}
src/Workspaces/Core/Portable/Remote/RemoteHostClient.cs
浏览文件 @
ee1cf15c
...
...
@@ -53,12 +53,7 @@ protected void Started()
OnStatusChanged
(
started
:
true
);
}
public
void
Dispose
()
{
Dispose
(
disposing
:
true
);
}
protected
virtual
void
Dispose
(
bool
disposing
)
public
virtual
void
Dispose
()
{
OnStatusChanged
(
started
:
false
);
}
...
...
@@ -220,7 +215,7 @@ protected Connection()
public
abstract
Task
<
T
>
InvokeAsync
<
T
>(
string
targetName
,
IReadOnlyList
<
object
>
arguments
,
CancellationToken
cancellationToken
);
public
abstract
Task
<
T
>
InvokeAsync
<
T
>(
string
targetName
,
IReadOnlyList
<
object
>
arguments
,
Func
<
Stream
,
CancellationToken
,
Task
<
T
>>
funcWithDirectStreamAsync
,
CancellationToken
cancellationToken
);
protected
virtual
void
Dispose
(
bool
disposing
)
protected
virtual
void
Dispose
Impl
(
)
{
// do nothing
}
...
...
@@ -234,7 +229,7 @@ public void Dispose()
_disposed
=
true
;
Dispose
(
disposing
:
true
);
Dispose
Impl
(
);
GC
.
SuppressFinalize
(
this
);
}
...
...
src/Workspaces/Core/Portable/TemporaryStorage/TemporaryStorageServiceFactory.MemoryMappedInfo.cs
浏览文件 @
ee1cf15c
...
...
@@ -168,20 +168,11 @@ public Stream CreateWritableStream()
}
public
void
Dispose
()
{
Dispose
(
true
);
GC
.
SuppressFinalize
(
this
);
}
private
void
Dispose
(
bool
disposing
)
{
if
(
disposing
)
{
// See remarks on field for relation between _memoryMappedFile and the views/streams. There is no
// need to write _weakReadAccessor here since lifetime of the target is not owned by this instance.
_memoryMappedFile
.
Dispose
();
}
}
private
unsafe
sealed
class
SharedReadableStream
:
Stream
,
ISupportDirectMemoryAccess
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录