Runtime: 죽은 코드 정리

에 만든 2017년 04월 05일  ·  152코멘트  ·  출처: dotnet/runtime

.NETCoreApp 바이너리에 대한 모노 링커를 활성화한 후 데드 코드가 있는 여러 위치를 식별했습니다.

이들은 3가지 범주로 나뉩니다.

  1. 어셈블리의 어느 곳에서도 사용되지 않는 정말 죽은 코드입니다.

    • 이것은 삭제할 수 있습니다

  2. 어셈블리의 한 빌드에서 사용되지만 전부는 아닌 소스 파일입니다. 일부 프로젝트에서 소스를 사용하지만 전부는 아닌 공통 소스 파일입니다.

    • 필요한 경우 최소한의 소스를 제공하기 위해 분할하여 더 잘 분해할 수 있습니다. 또는 실제로 죽은 코드를 포함할 수 있습니다.

  3. 컴파일 시간 전용 소스. IL을 호출할 때 리터럴로 표시되고 공개적으로 노출되지 않는 내부 상수입니다.

    • 이것들은 남아 있어야 합니다.

차이점

  • [ ] [Microsoft.CSharp](http://tempcoverage.blob.core.windows.net/report2/Microsoft.CSharp.diff.html) ( csv )
  • [ ] [Microsoft.VisualBasic](http://tempcoverage.blob.core.windows.net/report2/Microsoft.VisualBasic.diff.html) ( csv )
  • [x] [System.Collections.Concurrent](http://tempcoverage.blob.core.windows.net/report2/System.Collections.Concurrent.diff.html) ( csv )
  • [x] [System.Collections](http://tempcoverage.blob.core.windows.net/report2/System.Collections.diff.html) ( csv ) - @YoupHulsebos의 PR dotnet/corefx#19140
  • [x] [System.Collections.Immutable](http://tempcoverage.blob.core.windows.net/report2/System.Collections.Immutable.diff.html) ( csv ) - https에서 @YoupHulsebos 가 제거할 항목이 없습니다. //github.com/dotnet/corefx/issues/17905#issuecomment-298154133
  • [x] [System.Collections.NonGeneric]( http://tempcoverage.blob.core.windows.net/report2/System.Collections.NonGeneric.diff.html ) ( csv ) - https: //github.com/dotnet/corefx/issues/17905#issuecomment-298154133
  • [x] [System.Collections.Specialized](http://tempcoverage.blob.core.windows.net/report2/System.Collections.Specialized.diff.html) ( csv )
  • [x] [System.ComponentModel.Annotations](http://tempcoverage.blob.core.windows.net/report2/System.ComponentModel.Annotations.diff.html) ( csv ) @norek
  • [x] [System.ComponentModel](http://tempcoverage.blob.core.windows.net/report2/System.ComponentModel.diff.html) ( csv )@norek
  • [x] [System.ComponentModel.EventBasedAsync](http://tempcoverage.blob.core.windows.net/report2/System.ComponentModel.EventBasedAsync.diff.html) ( csv )@norek
  • [x] [System.ComponentModel.Primitives](http://tempcoverage.blob.core.windows.net/report2/System.ComponentModel.Primitives.diff.html) ( csv )@norek
  • [x] [System.ComponentModel.TypeConverter](http://tempcoverage.blob.core.windows.net/report2/System.ComponentModel.TypeConverter.diff.html) ( csv )@norek
  • [x] [System.Console](http://tempcoverage.blob.core.windows.net/report2/System.Console.diff.html) ( csv )
  • [x] [System.Data.Common](http://tempcoverage.blob.core.windows.net/report2/System.Data.Common.diff.html) ( csv ) - @에 의해 dotnet/corefx#19141에서 수정됨 YoupHulsebos
  • [x] [System.Diagnostics.Debug](http://tempcoverage.blob.core.windows.net/report2/System.Diagnostics.Debug.diff.html) ( csv )
  • [x] [System.Diagnostics.DiagnosticSource](http://tempcoverage.blob.core.windows.net/report2/System.Diagnostics.DiagnosticSource.diff.html) ( csv )
  • [x] [System.Diagnostics.FileVersionInfo](http://tempcoverage.blob.core.windows.net/report2/System.Diagnostics.FileVersionInfo.diff.html) ( csv )
  • [x] [System.Diagnostics.Process](http://tempcoverage.blob.core.windows.net/report2/System.Diagnostics.Process.diff.html) ( csv )
  • [x] [System.Diagnostics.StackTrace](http://tempcoverage.blob.core.windows.net/report2/System.Diagnostics.StackTrace.diff.html) ( csv )
  • [x] [System.Diagnostics.TextWriterTraceListener](http://tempcoverage.blob.core.windows.net/report2/System.Diagnostics.TextWriterTraceListener.diff.html) ( csv )
  • [x] [System.Diagnostics.Tools](http://tempcoverage.blob.core.windows.net/report2/System.Diagnostics.Tools.diff.html) ( csv )
  • [x] [System.Diagnostics.TraceSource](http://tempcoverage.blob.core.windows.net/report2/System.Diagnostics.TraceSource.diff.html) ( csv )
  • [x] [System.Diagnostics.Tracing](http://tempcoverage.blob.core.windows.net/report2/System.Diagnostics.Tracing.diff.html) ( csv )
  • [x] [System.Drawing.Primitives](http://tempcoverage.blob.core.windows.net/report2/System.Drawing.Primitives.diff.html) ( csv )
  • [ ] [시스템.IO.압축](http://tempcoverage.blob.core.windows.net/report2/System.IO.Compression.diff.html) ( csv )
  • [x] [System.IO.Compression.ZipFile](http://tempcoverage.blob.core.windows.net/report2/System.IO.Compression.ZipFile.diff.html) ( csv )
  • [ ] [System.IO.FileSystem.AccessControl](http://tempcoverage.blob.core.windows.net/report2/System.IO.FileSystem.AccessControl.diff.html) ( csv )
  • [ ] [System.IO.FileSystem](http://tempcoverage.blob.core.windows.net/report2/System.IO.FileSystem.diff.html) ( csv )
  • [x] [System.IO.FileSystem.DriveInfo](http://tempcoverage.blob.core.windows.net/report2/System.IO.FileSystem.DriveInfo.diff.html) ( csv )
  • [x] [System.IO.FileSystem.Watcher](http://tempcoverage.blob.core.windows.net/report2/System.IO.FileSystem.Watcher.diff.html) ( csv )
  • [x] [System.IO.IsolatedStorage](http://tempcoverage.blob.core.windows.net/report2/System.IO.IsolatedStorage.diff.html) ( csv )
  • [x] [System.IO.MemoryMappedFiles](http://tempcoverage.blob.core.windows.net/report2/System.IO.MemoryMappedFiles.diff.html) ( csv )
  • [x] [System.IO.Pipes](http://tempcoverage.blob.core.windows.net/report2/System.IO.Pipes.diff.html) ( csv )
  • [x] [System.Linq](http://tempcoverage.blob.core.windows.net/report2/System.Linq.diff.html) ( csv ) - 제거할 항목 없음, https://github.com/dotnet /corefx/issues/17905#issuecomment-294286344 작성자 @JonHanna
  • [x] [System.Linq.Expressions](http://tempcoverage.blob.core.windows.net/report2/System.Linq.Expressions.diff.html) ( csv )
  • [x] [System.Linq.Parallel](http://tempcoverage.blob.core.windows.net/report2/System.Linq.Parallel.diff.html) ( csv ) - @에 의해 dotnet/corefx#19143에서 수정되었습니다. YoupHulsebos
  • [x] [System.Linq.Queryable](http://tempcoverage.blob.core.windows.net/report2/System.Linq.Queryable.diff.html) ( csv ) - 제거할 항목 없음 - https://github .com/dotnet/corefx/issues/17905#issuecomment-294286344 작성자 @JonHanna
  • [ ] [시스템넷.Http](http://tempcoverage.blob.core.windows.net/report2/System.Net.Http.diff.html) ( csv )
  • [ ] [System.Net.HttpListener](http://tempcoverage.blob.core.windows.net/report2/System.Net.HttpListener.diff.html) ( csv )
  • [x] [System.Net.Mail](http://tempcoverage.blob.core.windows.net/report2/System.Net.Mail.diff.html) ( csv ) - @에 의해 dotnet/corefx#19532에서 수정됨 에르미아르
  • [x] [System.Net.NameResolution](http://tempcoverage.blob.core.windows.net/report2/System.Net.NameResolution.diff.html)( csv )
  • [ ] [System.Net.NetworkInformation](http://tempcoverage.blob.core.windows.net/report2/System.Net.NetworkInformation.diff.html) ( csv )
  • [x] [System.Net.Ping](http://tempcoverage.blob.core.windows.net/report2/System.Net.Ping.diff.html) ( csv )
  • [ ] [System.Net.Primitives](http://tempcoverage.blob.core.windows.net/report2/System.Net.Primitives.diff.html) ( csv )
  • [ ] [System.Net.Requests](http://tempcoverage.blob.core.windows.net/report2/System.Net.Requests.diff.html) ( csv )
  • [ ] [System.Net.Security](http://tempcoverage.blob.core.windows.net/report2/System.Net.Security.diff.html) ( csv )
  • [x] [System.Net.ServicePoint](http://tempcoverage.blob.core.windows.net/report2/System.Net.ServicePoint.diff.html) ( csv )
  • [ ] [System.Net.Sockets](http://tempcoverage.blob.core.windows.net/report2/System.Net.Sockets.diff.html) ( csv )
  • [ ] [시스템넷.웹클라이언트](http://tempcoverage.blob.core.windows.net/report2/System.Net.WebClient.diff.html) ( csv )
  • [ ] [System.Net.WebHeaderCollection](http://tempcoverage.blob.core.windows.net/report2/System.Net.WebHeaderCollection.diff.html) ( csv )
  • [x] [System.Net.WebProxy](http://tempcoverage.blob.core.windows.net/report2/System.Net.WebProxy.diff.html) ( csv )
  • [ ] [System.Net.WebSockets.Client](http://tempcoverage.blob.core.windows.net/report2/System.Net.WebSockets.Client.diff.html) ( csv )
  • [ ] [System.Net.WebSockets](http://tempcoverage.blob.core.windows.net/report2/System.Net.WebSockets.diff.html) ( csv )
  • [x] [System.Numerics.Vectors](http://tempcoverage.blob.core.windows.net/report2/System.Numerics.Vectors.diff.html) ( csv )
  • [x] [System.ObjectModel](http://tempcoverage.blob.core.windows.net/report2/System.ObjectModel.diff.html) ( csv )
  • [ ] [System.Private.DataContractSerialization](http://tempcoverage.blob.core.windows.net/report2/System.Private.DataContractSerialization.diff.html) ( csv )
  • [ ] [System.Private.Uri](http://tempcoverage.blob.core.windows.net/report2/System.Private.Uri.diff.html) ( csv )
  • [x] [System.Private.Xml](http://tempcoverage.blob.core.windows.net/report2/System.Private.Xml.diff.html) ( csv )
  • [x] [System.Private.Xml.Linq](http://tempcoverage.blob.core.windows.net/report2/System.Private.Xml.Linq.diff.html) ( csv )
  • [x] [System.Reflection.DispatchProxy](http://tempcoverage.blob.core.windows.net/report2/System.Reflection.DispatchProxy.diff.html) ( csv )
  • [x] [System.Reflection.Metadata](http://tempcoverage.blob.core.windows.net/report2/System.Reflection.Metadata.diff.html) ( csv )
  • [x] [System.Reflection.TypeExtensions](http://tempcoverage.blob.core.windows.net/report2/System.Reflection.TypeExtensions.diff.html) ( csv )
  • [x] [System.Resources.Writer](http://tempcoverage.blob.core.windows.net/report2/System.Resources.Writer.diff.html) ( csv )
  • [x] [System.Runtime.CompilerServices.VisualC](http://tempcoverage.blob.core.windows.net/report2/System.Runtime.CompilerServices.VisualC.diff.html) ( csv )
  • [ ] [시스템.런타임](http://tempcoverage.blob.core.windows.net/report2/System.Runtime.diff.html) ( csv )
  • [x] [System.Runtime.Extensions](http://tempcoverage.blob.core.windows.net/report2/System.Runtime.Extensions.diff.html) ( csv )
  • [x] [System.Runtime.InteropServices](http://tempcoverage.blob.core.windows.net/report2/System.Runtime.InteropServices.diff.html) ( csv )
  • [x] [System.Runtime.InteropServices.RuntimeInformation](http://tempcoverage.blob.core.windows.net/report2/System.Runtime.InteropServices.RuntimeInformation.diff.html)( csv )
  • [x] [System.Runtime.Numerics](http://tempcoverage.blob.core.windows.net/report2/System.Runtime.Numerics.diff.html) ( csv )
  • [x] [System.Runtime.Serialization.Formatters](http://tempcoverage.blob.core.windows.net/report2/System.Runtime.Serialization.Formatters.diff.html) ( csv ) - dotnet/corefx에서 수정됨 #19148 by @yaelkeemink
  • [ ] [System.Runtime.Serialization.Primitives](http://tempcoverage.blob.core.windows.net/report2/System.Runtime.Serialization.Primitives.diff.html) ( csv )
  • [ ] [System.Security.AccessControl](http://tempcoverage.blob.core.windows.net/report2/System.Security.AccessControl.diff.html) ( csv )
  • [ ] [System.Security.Claims](http://tempcoverage.blob.core.windows.net/report2/System.Security.Claims.diff.html) ( csv )
  • [ ] [System.Security.Cryptography.Algorithms](http://tempcoverage.blob.core.windows.net/report2/System.Security.Cryptography.Algorithms.diff.html) ( csv ) @mccbraxton
  • [ ] [System.Security.Cryptography.Cng](http://tempcoverage.blob.core.windows.net/report2/System.Security.Cryptography.Cng.diff.html) ( csv )
  • [ ] [System.Security.Cryptography.Csp](http://tempcoverage.blob.core.windows.net/report2/System.Security.Cryptography.Csp.diff.html) ( csv )
  • [ ] [System.Security.Cryptography.Encoding](http://tempcoverage.blob.core.windows.net/report2/System.Security.Cryptography.Encoding.diff.html) ( csv )
  • [ ] [System.Security.Cryptography.OpenSsl](http://tempcoverage.blob.core.windows.net/report2/System.Security.Cryptography.OpenSsl.diff.html) ( csv )
  • [x] [System.Security.Cryptography.Primitives](http://tempcoverage.blob.core.windows.net/report2/System.Security.Cryptography.Primitives.diff.html) ( csv )
  • [x] [System.Security.Cryptography.X509Certificates](http://tempcoverage.blob.core.windows.net/report2/System.Security.Cryptography.X509Certificates.diff.html) ( csv ) - dotnet/corefx에서 수정됨 #19144 by @yaelkeemink
  • [x] [System.Security.Principal](http://tempcoverage.blob.core.windows.net/report2/System.Security.Principal.diff.html) ( csv ) - 제거할 항목 없음
  • [x] [Microsoft.Win32.Primitives](http://tempcoverage.blob.core.windows.net/report2/Microsoft.Win32.Primitives.diff.html) ( csv )
  • [x] [Microsoft.Win32.Registry](http://tempcoverage.blob.core.windows.net/report2/Microsoft.Win32.Registry.diff.html) ( csv )
  • [ ] [Microsoft.XmlSerializer.Generator](http://tempcoverage.blob.core.windows.net/report2/Microsoft.XmlSerializer.Generator.diff.html) ( csv )
  • [x] [System.Security.Principal.Windows](http://tempcoverage.blob.core.windows.net/report2/System.Security.Principal.Windows.diff.html) ( csv ) - dotnet/corefx#18267
  • [x] [System.Text.RegularExpressions](http://tempcoverage.blob.core.windows.net/report2/System.Text.RegularExpressions.diff.html) ( csv ) - dotnet/corefx#18134
  • [x] [System.Threading](http://tempcoverage.blob.core.windows.net/report2/System.Threading.diff.html) ( csv ) - dotnet/corefx#18134
  • [x] [System.Threading.Overlapped](http://tempcoverage.blob.core.windows.net/report2/System.Threading.Overlapped.diff.html) ( csv ) - dotnet/corefx#18134
  • [x] [System.Threading.Tasks.Dataflow](http://tempcoverage.blob.core.windows.net/report2/System.Threading.Tasks.Dataflow.diff.html) ( csv ) - dotnet/corefx#17998
  • [x] [System.Threading.Tasks.Extensions](http://tempcoverage.blob.core.windows.net/report2/System.Threading.Tasks.Extensions.diff.html) ( csv ) - 제거할 항목이 없습니다.
  • [x] [System.Threading.Tasks.Parallel](http://tempcoverage.blob.core.windows.net/report2/System.Threading.Tasks.Parallel.diff.html) ( csv ) - 제거할 항목이 없습니다.
  • [x] [System.Threading.Thread](http://tempcoverage.blob.core.windows.net/report2/System.Threading.Thread.diff.html) ( csv ) - 제거할 항목 없음
  • [x] [System.Transactions.Local](http://tempcoverage.blob.core.windows.net/report2/System.Transactions.Local.diff.html) ( csv )
  • [x] [System.Web.HttpUtility](http://tempcoverage.blob.core.windows.net/report2/System.Web.HttpUtility.diff.html) ( csv ) - 제거할 항목 없음
  • [x] [System.Xml.XPath.XDocument](http://tempcoverage.blob.core.windows.net/report2/System.Xml.XPath.XDocument.diff.html) ( csv ) - 제거할 항목이 없습니다.

배경

보고서는 ILLink(codegen 팀 /cc @erozenfeld의 모노 링커 빌드)를 활성화하고 출력을 비교하여 생성되었습니다.

diff는 Windows 빌드에서 가져온 것이며 NETCore.App의 일부인 어셈블리로만 제한됩니다.

링커가 활성화되면 어셈블리의 개체 폴더에 "PreTrim" 폴더가 생성됩니다(예 <corefx>\bin\obj\AnyOS.AnyCPU.Debug\Microsoft.CSharp\netstandard\PreTrim\Microsoft.CSharp.dll ).

트리밍된 어셈블리의 중앙 복사본을 활성화하려면 BinPlaceILLinkTrimAssembly=true 속성을 설정할 수 있습니다. 그러면 사전 트리밍되고 트리밍된 모든 어셈블리가 bin: <corefx>\bin\ILLinkTrimAssembly\netcoreapp-Windows_NT-Debug-x64 아래의 폴더에 복사됩니다.

이 문제에 연결된 보고서를 생성하려면 AsmDiff.exe 도구의 복사본이 있어야 합니다. 이 도구는 아직 코어에 사용할 수 없습니다(https://github.com/dotnet/buildtools/issues/1420). 도구의 데스크톱 버전이 있는 경우 AsmDiffCmd=<pathToAsmDiff.exe> 를 설정하여 보고를 활성화할 수 있습니다.

링커는 https://github.com/dotnet/corefx/pull/17825가 병합된 후 ILLinkTrimAssembly=true 로 빌드하여 모든 프로젝트(NETCore.App의 프로젝트뿐만 아니라)에 대해 활성화할 수 있습니다.

도서관을 다루는 방법

라이브러리를 선택하고 작업할 메모를 작성하십시오.

라이브러리에 대한 위의 html 보고서를 엽니다. 빨간색 선을 찾으십시오. 이들은 이론적으로 죽었다. 이 repo의 src 폴더에서 코드를 검색하여 삭제합니다. 라이브러리에 대한 보고서를 계속 진행하고 이와 같은 데드 코드를 모두 삭제합니다.

그러나 몇 가지 특별한 경우가 있습니다.

  1. 이것은 매우 일반적인 것입니다. "const"가 있는 것은 무시하십시오. 이것들은 모두 컴파일러에 의해 인라인된 필드이며 소스에 유지하려고 합니다. 일반적으로 int 및 문자열입니다.
  2. "클래스 SR"에서 "정적 문자열"인 모든 것은 특별합니다. C# 파일을 편집하는 대신 .resx 파일에서 일치하는 항목을 찾아 제거해야 합니다. 라이브러리의 .resx 파일은 src\<library>\src\Resources\strings.resx 에 있습니다. 이 작업을 수행하면 빌드가 SR을 재생성합니다. "클래스 SR"의 다른 것은 무시하십시오. 죽은 것으로 나타날 수 있는 몇 가지 메서드가 있습니다.
  3. 매개변수가 없는 개인 생성자를 무시하십시오. 실수로 클래스를 인스턴스화하는 것을 방지하기 위해 코드에 이러한 항목이 있으므로 코드에 유지하려고 합니다.
  4. 다른 생성자가 없는 경우 매개 변수가 없는 공용 생성자를 무시합니다. 이것들은 진짜가 아닙니다.
  5. 일부 코드는 라이브러리 폴더 아래에 있지 않고 src\common에 있습니다. 이 코드는 다른 라이브러리에서 사용할 수 있기 때문에 실제로 죽지 않았을 수 있습니다. 이상적으로는 grep을 사용하여 트리의 다른 사람이 사용하는지 확인합니다. 사용하는 경우 삭제할 수 있습니다. 또는 무시하고 나중에 다른 패스를 수행할 수 있습니다.
  6. 코드가 Unix, UAP 등에서만 사용되는 경우 삭제하지 마십시오. 죽지 않았을 가능성이 큽니다. #if uap 로 둘러싸이거나 '$(TargetGroup)' == 'uap'" 와 같은 .csproj 파일에 조건이 있으면 이러한 유형인지 여부를 알 수 있습니다.

라이브러리에서 데드 코드를 제거한 후 빌드를 확인합니다(라이브러리의 "src" 폴더에서 "msbuild" 실행). 그렇지 않은 경우 뒤로 이동합니다. 빌드되면 테스트 빌드를 확인하고 통과합니다("tests" 폴더에서 "msbuild /t:buildandtest" 실행). 그렇지 않은 경우 다시 단계를 추적하십시오.

모든 것이 좋아 보인다면 라이브러리에 대한 PR을 올릴 수 있습니다. PR이 들어가면 여기에서 확인할 수 있습니다.

area-Meta easy enhancement untriaged up-for-grabs

모든 152 댓글

다음은 diff를 바이트 단위로 내림차순으로 나열한 표입니다. XML에는 이미 문제가 있습니다.

| | | |
|---------------------------------------------------- ------|------------------|------------|
| 도서관 | 제거된 바이트 | % 감소 |
| 총계 | 1221632 | 7.62% |
| Microsoft.XmlSerializer.Generator.dll | 392704 | 46.29% |
| System.Private.Xml.dll - dotnet/runtime#20506 | 93696 | 2.54% |
| System.Net.Http.dll | 42496 | 12.89% |
| System.Private.DataContractSerialization.dll | 39936 | 4.40% |
| System.ComponentModel.TypeConverter.dll | 36352 | 10.71% |
| System.Data.Common.dll | 36352 | 2.97% |
| System.IO.FileSystem.dll | 32768 | 26.56% |
| System.Net.HttpListener.dll | 32256 | 9.39% |
| System.Runtime.Extensions.dll | 31744 | 12.20% |
| System.Net.Mail.dll | 28672 | 10.81% |
| System.Net.Security.dll | 24064 | 9.73% |
| System.Security.Cryptography.X509Certificates.dll | 23552 | 15.13% |
| System.Net.WebSockets.Client.dll | 22016 | 27.22% |
| System.Net.Primitives.dll | 20992 | 21.58% |
| System.Net.Requests.dll | 20480 | 11.56% |
| System.IO.FileSystem.DriveInfo.dll | 18944 | 47.44% |
| System.Transactions.Local.dll | 17920 | 9.70% |
| System.Net.NetworkInformation.dll | 17408 | 15.45% |
| System.Net.NameResolution.dll | 15360 | 28.30% |
| System.Net.WebHeaderCollection.dll | 14336 | 34.57% |
| System.Net.Sockets.dll | 12288 | 5.35% |
| System.IO.FileSystem.Watcher.dll | 11776 | 28.40% |
| System.IO.Compression.dll | 11264 | 7.83% |
| System.Security.Cryptography.Algorithms.dll | 10240 | 7.04% |
| System.Threading.dll | 10240 | 15.15% |
| System.IO.Pipes.dll | 9728 | 14.18% |
| System.Diagnostics.Process.dll | 9216 | 7.83% |
| System.Security.Cryptography.Encoding.dll | 9216 | 22.22% |
| System.IO.MemoryMappedFiles.dll | 8704 | 19.77% |
| System.Security.Cryptography.Csp.dll | 8704 | 9.83% |
| System.Security.AccessControl.dll | 8192 | 7.69% |
| System.Security.Cryptography.Cng.dll | 7680 | 7.04% |
| System.Collections.dll | 7168 | 5.88% |
| System.Net.Ping.dll | 7168 | 15.05% |
| System.Console.dll | 6656 | 7.51% |
| System.Linq.Expressions.dll | 6656 | 1.03% |
| System.Security.Principal.Windows.dll | 6656 | 9.29% |
| Microsoft.Win32.Registry.dll | 6144 | 12.77% |
| System.Private.Uri.dll | 6144 | 5.41% |
| System.Net.WebClient.dll | 5632 | 8.27% |
| System.Private.Xml.Linq.dll | 5632 | 3.37% |
| Microsoft.CSharp.dll | 4096 | 0.78% |
| System.ComponentModel.Primitives.dll | 4096 | 16.00% |
| System.Reflection.Metadata.dll | 4096 | 0.81% |
| System.Threading.Tasks.Dataflow.dll | 4096 | 1.86% |
| System.Diagnostics.StackTrace.dll | 3584 | 20.59% |
| System.IO.FileSystem.AccessControl.dll | 3584 | 12.96% |
| System.Linq.Parallel.dll | 3584 | 1.41% |
| System.Text.RegularExpressions.dll | 3584 | 2.59% |
| System.IO.IsolatedStorage.dll | 3072 | 8.00% |
| System.Threading.Overlapped.dll | 3072 | 28.57% |
| System.Security.Claims.dll | 2560 | 5.32% |
| Microsoft.VisualBasic.dll | 2048 | 1.05% |
| System.Collections.Concurrent.dll | 2048 | 2.03% |
| System.Collections.NonGeneric.dll | 2048 | 4.44% |
| System.Diagnostics.TraceSource.dll | 2048 | 4.08% |
| System.Diagnostics.Tracing.dll | 2048 | 11.11% |
| System.Runtime.InteropServices.RuntimeInformation.dll | 2048 | 16.00% |
| System.Threading.Tasks.Parallel.dll | 2048 | 4.17% |
| Microsoft.Win32.Primitives.dll | 1536 | 17.65% |
| System.Collections.Specialized.dll | 1536 | 3.66% |
| System.ComponentModel.Annotations.dll | 1536 | 1.94% |
| System.Diagnostics.FileVersionInfo.dll | 1536 | 10.71% |
| System.Reflection.DispatchProxy.dll | 1536 | 5.36% |
| System.Resources.Writer.dll | 1536 | 7.69% |
| System.Runtime.Serialization.Formatters.dll | 1536 | 1.10% |
| System.Threading.Thread.dll | 1536 | 6.82% |
| System.ComponentModel.EventBasedAsync.dll | 1024 | 5.71% |
| System.Drawing.Primitives.dll | 1024 | 2.30% |
| System.IO.Compression.ZipFile.dll | 1024 | 6.90% |
| System.Linq.dll | 1024 | 0.69% |
| System.Linq.Queryable.dll | 1024 | 1.60% |
| System.Net.ServicePoint.dll | 1024 | 6.25% |
| System.ObjectModel.dll | 1024 | 2.63% |
| System.Runtime.InteropServices.dll | 1024 | 4.17% |
| System.Runtime.Numerics.dll | 1024 | 1.41% |
| System.Runtime.Serialization.Primitives.dll | 1024 | 7.69% |
| System.Security.Cryptography.Primitives.dll | 1024 | 2.41% |
| System.AppContext.dll | 512 | 8.33% |
| System.Collections.Immutable.dll | 512 | 0.26% |
| System.Diagnostics.DiagnosticSource.dll | 512 | 1.69% |
| System.Diagnostics.TextWriterTraceListener.dll | 512 | 4.35% |
| System.Globalization.Extensions.dll | 512 | 7.14% |
| System.Net.WebProxy.dll | 512 | 4.55% |
| System.Net.WebSockets.dll | 512 | 2.50% |
| System.Numerics.Vectors.dll | 512 | 0.32% |
| System.Reflection.Primitives.dll | 512 | 7.14% |
| System.Reflection.TypeExtensions.dll | 512 | 3.57% |
| System.Runtime.dll | 512 | 1.43% |
| System.Security.Cryptography.OpenSsl.dll | 512 | 6.25% |
| System.Xml.XmlSerializer.dll | 512 | 5.56% |
| System.Xml.XPath.XDocument.dll | 512 | 6.67% |

이것은 새로운 기여자가 잡을 수 있는 아주 쉬운 문제입니다. htm 파일 중 하나를 열고 빨간색으로 표시된 소스를 삭제하십시오.

분명한 사실은 생성된 SR 클래스에는 거의 항상 사용되지 않는 여러 멤버가 있으며 모든(또는 적어도 대부분) 어셈블리에 표시된다는 것입니다. 우리가 그것을 고칠 방법을 알아낸다면 그것은 우리에게 몇 가지 쉬운 전역적 개선을 줄 수 있습니다.

또한 경우에 따라 private const 필드가 표시됩니다. 그것들은 해당 클래스의 구현에서 사용되지만 분명히 외부에서 보이지 않거나 사용되지 않습니다. 이러한 문제를 "수정"하는 것은 가치가 없을 것입니다.

private const 필드를 사용하는 클래스 구현이 어셈블리 외부에 표시되는 진입점을 통해 도달할 수 있는 경우 필드는 제거되지 않습니다.

아마도 라이브러리에 내부 볼 수 있는 항목이 있는 경우(예: 단위 테스트의 경우) 가양성을 볼 수 있습니다. 맞습니까?

어셈블리에 InternalsVisibleTo가 있으면 모든 내부도 루트로 간주됩니다.

확인. 테스트에서 내부를 얻기 위해 리플렉션을 사용하는 몇 가지 경우가 있다고 생각합니다. 그러나 테스트를 실행하면 빠르게 발견될 것입니다.

@멜리노에

분명한 사실은 생성된 SR 클래스에는 거의 항상 사용되지 않는 여러 멤버가 있으며 모든(또는 적어도 대부분) 어셈블리에 표시된다는 것입니다. 우리가 그것을 고칠 방법을 알아낸다면 그것은 우리에게 몇 가지 쉬운 전역적 개선을 줄 수 있습니다.

나는 이미 2월에 100개의 죽은 문자열을 삭제하는 데 통과했습니다. 거의 남지 않을 것입니다. 문자열을 참조하는 메서드 자체가 잘리는 경우라고 생각합니다. 물론 resx를 트리밍해야 하는 경우입니다.

@danmosemsft 저는 생성된 파일에서 항상 방출되는 이 멤버 블록을 언급하고 있습니다.

C# internal static string Format(string resourceFormat, object p1); internal static string Format(string resourceFormat, object p1, object p2); internal static string Format(string resourceFormat, object p1, object p2, object p3); internal static string Format(string resourceFormat, params object[] args);

종종(적어도 내 간단한 훑어보기 😄에서) 첫 번째만 사용하고 때로는 두 번째만 사용합니다. 내가 클릭한 것 중 일부에서 이것은 diff의 가장 큰 덩어리였습니다.

확인. 테스트에서 내부를 얻기 위해 리플렉션을 사용하는 몇 가지 경우가 있다고 생각합니다. 그러나 테스트를 실행하면 빠르게 발견될 것입니다.

나는 이미 그 대부분을 다루었습니다. https://github.com/dotnet/corefx/pull/17825/commits/2277db969616a5ad4fd9f4a8118a3b4030ff62d3

우리는 이미 내부 및 외부 루프가 깨끗합니다.

Dataflow에 대한 보고서에 따르면 System.Threading.Tasks.Dataflow.Internal.Threading 네임스페이스의 유형이 중단되었습니다. 사실이 아닙니다. 기본 구성에서는 작동하지 않지만 이를 사용하는 다른 구성이 있습니다. 제안된 변경 사항은 https://github.com/dotnet/corefx/pull/17912 를 참조하세요.

그런 종류가 또 있을까요? 그들에 대해 해야 할 일이 있습니까?

이 보고서는 Windows의 NETCoreApp에만 해당됩니다. 다른 구성에서 여전히 이를 사용하고 누군가가 완전히 제거하려고 하면 -allConfigurations 빌드에 의해 catch될 수 있습니다. 이와 같은 경우 위의 항목 2에서 언급한 대로 소스를 if-def'ing/분할하여 NETCoreApp 구성을 개선할 수 있습니다. 이것은 dotnet/corefx#17912에서 수행하는 작업과 같습니다.

링커를 실행하지 않는 다른 구성에 대한 diff를 식별하는 데 관심이 있다면 배경 섹션에 나열된 세부 정보를 사용하여 켤 수 있습니다. PR이 병합되면 더 쉬울 것이므로 기다리기만 하면 됩니다.

@erozenfeld 우리는 코드 명확성을 잃기 때문에 컴파일러에 의해 인라인되기 때문에 단순히 const를 제거하고 싶지 않습니다. 그러나 const 중 일부는 실제로 죽었고 아마도 제거하고 싶을 것입니다.

예를 들어 http://tempcoverage.blob.core.windows.net/report2/System.ComponentModel.TypeConverter.diff.html 에서 VSStandardCommands 전체가 죽은 것으로 표시됩니다. 일부는 표시되며( public class StandardCommands 를 통해) 인라인됩니다. 그러나 일부는 실제로 죽었습니다. 예: cmdidThisWindow

어느 것이 후자의 범주에 속하는지 볼 수 있으면 좋을 것입니다.

맞습니다, 우리는 소스에서 컴파일러에 의해 인라인된 const를 제거할 수 없습니다. ILLink는 msil에서 작동하며 모든 곳에서 인라인되었기 때문에 완전히 죽은 상수와 죽은 상수를 구별할 수 없습니다.

또한 임의의 매개변수 없는 구성을 방지하기 위해 일반적으로 제거하고 싶지 않은 개인 기본 생성자를 죽은 것으로 표시합니다. 같은 이유로 불가피하다고 생각합니다. 내가 생각할 수있는 한 컴파일 시간 이후에는 아무 목적도 없습니다.

위의 논의에 따라 '쉬움'으로 표시. 나는 이 문제에 대해 처음으로 기여한 몇 사람을 지적할 계획입니다.

누군가 파일을 선택하는 경우 작업의 중복을 피하기 위해 이 문제에 대해 그렇게 말하십시오.

@danmosemsft 여기에도 공급업체에 보낸 방법을 추가하시겠습니까? 모든 예외/피해야 할 사항을 제외하고 상단 게시물에 추가하는 것이 가장 좋습니다.

@karelz 완료

나는 diffs를 피상적으로 살펴 보았다. 너무 많은 소음이 있습니다. 쉽고 실행 가능한 것을 찾기가 어려웠습니다. diff(consts, 매개변수가 없는 private 생성자, ...)에서 노이즈를 필터링하여 쉽게 실행할 수 있는 항목만 갖도록 할 수 있습니까?

CSV를 열고 원하는 필터를 적용할 수 있습니다.

마스터 CSV를 만지작거리며 /src/common의 어떤 코드가 실제로 죽었는지 확인하는 것이 좋습니다.

@erozenfeld 여기에 뭔가 빠졌을 수 있습니다. http://tempcoverage.blob.core.windows.net/report2/System.Reflection.DispatchProxy.diff.html 에서 EventAccessorInfo.InterfaceRaiseMethod 가 죽었지만 생성자에 설정되어 있다고 말합니다. 죽은.
https://github.com/dotnet/corefx/blob/master/src/System.Reflection.DispatchProxy/src/System/Reflection/DispatchProxyGenerator.cs#L919

손쉬운 제거 및 쉽게, 준비가 되지 않은 것 같습니다(제가 틀렸다고 생각되면 자유롭게 변경하십시오)

어떻게 준비되지 않았는지 모르겠고 지침은 꽤 명확합니다... 일종의 좋은 소개라고 생각합니다. 어쨌든 공급 업체 사람들이 시작합니다. 나는 이미 일부를 수행하고 이미 깨끗한 많은 것을 확인했습니다.

죽은 것으로 잘못 표시되는 다른 것: SR.GetResourceString("...")을 통해 런타임에 로드되는 문자열입니다. 불행히도 return SR.GetResourceString("PropertyCategory" + value, null); 와 같은 몇 가지가 있습니다.

코드 리뷰에서 잡아야 합니다.

실을 훑어보니 결과에 노이즈의 우려가 있는 것처럼 보였습니다. 다시 말하지만, 나는 강하게 느껴지지 않습니다. 자유롭게 뒤로 뒤집으십시오 ;-)

괜찮아 :)

System.Transactions.Local에는 현재 액세스되지 않는 코드가 있지만 분산 트랜잭션 지원 작업을 수행하면 일부는 결국 액세스됩니다. 나는 단순히 이 코드를 제거하기를 꺼립니다.

여기 Microsoft.CSharp에서 확인된 데드 코드 중 일부와 그 이상을 이미 제거했으며(예: dotnet/corefx#17948에 따라 ExpressionBinder.BindPtrToArray 가 죽었다는 것을 분석에서 발견하지 못했습니다) 나머지는 내 그 어셈블리의 지속적인 리팩토링의 일부로 명소.

@danmosemsft EventAccessorInfo.InterfaceRaiseMethod 관련: get_InterfaceRaiseMethod가 죽고 set_InterfaceRaiseMethod가 없기 때문에 속성이 죽었다는 것입니다. 생성자의 코드는 컴파일러 생성 지원 필드를 설정합니다.k__BackingField 및 ILLink는 필드를 유지합니다.

의미가 있는 @jimcarley , 위의 S.Transactions.Local을 확인했습니다. 실제로 죽은 확률과 끝이 있다면 어느 시점에서 제거하고 싶을 수도 있습니다.

@JonHanna ILLink 가 그 코드가 죽었다는 것을 알아차릴 수 있어야 한다고 생각한다면 @erozenfeld 에게 알려 드리겠습니다.

@danmosemsft 가능하다면 매우 감명을 받았을 것입니다. 여기에 언급된 비트는 이미 제거하려는 부분의 하위 집합이므로 목록의 해당 항목을 다룰 것입니다.

@danmosemsft @JonHanna ILLink는 메소드 내에서 도달할 수 없는 코드를 찾으려고 시도하지 않습니다. 메소드에 도달할 수 있는 경우 메소드 내의 모든 명령어에 도달할 수 있다고 가정합니다.

다른 사람들을 위해: 죽은 것으로 플래그가 지정된 생성자에 의해 int 필드가 할당되는 또 다른 경우가 오프라인으로 발생했습니다. 그러나 그 필드는 다른 곳에서 읽혀지고 있었고 해당 생성자가 제거되면 컴파일러는 필드가 설정되지 않는다고 경고했습니다. 리더가 기본값을 읽고 있었습니다. 이러한 경우 데드 세터를 제거할 때 필드를 명시적으로 초기화해야 합니다.

@erozenfeld 이 코드는 죽은 것 같습니다: https://github.com/dotnet/corefx/compare/master...danmosemsft :dead.xml?expand=1
그러나 죽은 것으로 표시되지 않았습니다. IL(구조체의 필드)에 있습니다. ILLink는 예를 들어 interop에서 사용되는 경우 구조체에서 필드를 제거하는 것을 특별히 피합니까?

이 특별한 경우 필드는 암시적 정적 생성자에서 초기화되므로 IL에서 사용되는 것처럼 보입니다. 데드 코드로 감지하려면 ILLink는 다음을 수행해야 합니다.

  • 필드가 정적 생성자에 할당되고 값이 다른 곳에서 사용되지 않음을 감지합니다.
  • 이 필드의 할당에는 부작용이 없습니다.
  • 정적 생성자의 메서드 본문을 다시 작성하여 이러한 필드의 할당을 제거하되 다른 모든 것은 그대로 유지합니다.

아 - 물론입니다.

https://github.com/dotnet/corefx/pull/18395/files 에 있는 것처럼 이것들을 발견했습니다. 죽은 다양한 상수가 있습니다(물론 ILLink는 모든 상수를 보여주기 때문에 알 수 없습니다. as dead) 그리고 초기화와 같은 것은 인간만이 말할 수 있는 부작용이 없습니다. ILLink가 찾지 말았어야 하는 것은 없습니다.

@huanwu SGEN 도구에는 400KB의 데드 코드가 있습니다.
이 모든 것을 제거하는 것이 합리적입니까 아니면 작업이 진행 중입니까? 이 코드를 사용하시겠습니까?

http://tempcoverage.blob.core.windows.net/report2/Microsoft.XmlSerializer.Generator.diff.html 참조

System.Linq 및 System.Linq.Queryable에서 플래그가 지정된 유일한 코드는 동일한 클래스의 다른 메서드가 해당 프로젝트에서 사용되는 공통 파일의 메서드 또는 상수를 사용하는 것이므로 추가 작업이 필요하지 않습니다.

방금 작성한 도구를 사용하여 데드 코드를 식별했습니다( https://github.com/dotnet/corefx/pull/18395 참조). 내 코드의 유효성을 검사하기 위해 입력 데이터로 귀하의 코드를 사용하고 있습니다.

과거에 나는 죽지 않아야 하는 코드를 식별하는 데 능숙했던 Roslyn(18.5kloc)에서 대량 삭제를 수행했습니다 . https://github.com/dotnet/roslyn/pull/17630의 주석을 참조하세요. 즉, 회귀로 인해 디버거에서만 사용되며 테스트의 불완전한 구현은 조건부로 컴파일되어야 합니다.

@JonHanna 감사합니다! 귀하의 정보로 업데이트된 인기 게시물입니다.

dotnet/corefx#18414는 S.Linq.Expressions에서 관련 데드 코드 대부분을 제거했습니다. 상수 등을 제외하고 현재 지원되지 않는 기능이 이식되면 관련될 수 있는 몇 가지가 있으므로(그냥 요청하는 문제가 있는 기능 포함) 지금은 더 이상 수행하지 않는 것이 가장 좋습니다.

좋은 것 같습니다. 목록이 선택 해제되어 있습니다. 나머지 대부분은 최소한의 정리만 필요합니다. SGEN은 주요 예외입니다( @huanwu 는 위의 질문을 참조하십시오)

Microsoft.XmlSerializer.Generator.dll에 대한 위의 @zhenlan 질문 -- 400KB의 데드 코드(!)가 있습니다. 이 코드는 일시적으로 중단되었거나, 이 작업을 완료하고 누군가 삭제할 수 있습니까? 대부분의 경우 공급업체에 많은 작업을 요청할 수 있습니다. 바로 알려주세요.

@danmosemsft 이것은 죽은 코드가 아닙니다. 대부분의 코드는 System.Private.Xml과 공유됩니다. 프로젝트 파일 https://github.com/dotnet/corefx/blob/master/src/Microsoft.XmlSerializer.Generator/src/Microsoft.XmlSerializer.Generator.csproj 를 확인하면 대부분의 코드 파일이 다음 위치에 있음을 확인할 수 있습니다. $(SourceDir)SystemXml 직렬화

@huanwu 리포지토리 에서 코드를 삭제할 수 없더라도(다른 사람이 사용하기 때문에) 코드가 이 어셈블리 내에서 사용되지 않는다면 이상적으로는 어셈블리로 컴파일하지 않을 것입니다.
ReflectionAwareCodeGen
XmlSerializationWriterCodeGen
XmlSerializationCodeGen
모두 죽은 수업처럼 보입니다. 이상적으로는 자체 코드 파일로 이동할 수 있으므로 필요한 위치에서만 컴파일됩니다.

ReflectionAwareCodeGen은 실제로 #if XMLSERIALIZERGENERATOR 내에 있으므로 이 어셈블리에서 죽은 경우 완전히 죽은 것일 수 있습니다.

또한 이 바이너리에서는 대부분의 문자열이 사용되지 않습니다.

이 코드가 이 어셈블리에서 죽으면 400KB를 절약할 수 있으므로 수행할 가치가 있습니다.

@danmosemsft 님 안녕하세요, 죽은 코드가 어떻게 결정되는지 완전히 이해하지 못할 수도 있지만 뭔가 기분이 나쁩니다.

예를 들어, diff 파일 Microsoft.XmlSerializer.GeneratorReflectionAwareCodeGen 를 빨간색으로 표시했는데, 도구의 관점에서 이를 데드 코드로 해석했습니다. 그러나 여기 Microsoft.XmlSerializer.Generator 에서 분명히 사용됩니다. 명확히하는 데 도움을 주시겠습니까?

자, 도구가 실제로 *CodeGen의 전체 체인을 데드 코드로 표시한 것을 보았습니다. 이전 질문을 무시하고 설명하겠습니다. Microsoft.XmlSerializer.Generator 프로젝트에 초기 체크인이 있었습니다. 일부 코드는 일시적으로만 죽었습니다. 더 많은 작업이 완료되면 사용됩니다. 코드 완성에 가까워지면 도구를 다시 실행할 수 있을까요?

@zhenlan 그게 바로 내가 가정한 것입니다. 코드 완성은 실제로 지난 주였습니다. :) 아마도 이것은 DCR일 것입니다. 할 일이 더 많습니까?

@danmosemsft 네 추측하신 내용이 맞습니다 :)

Microsoft.XmlSerializer.Generator(Sgen)는 .NET Core의 일부로 제공되지 않는 CLI 도구입니다. Sgen이 S.Private.Xml과 공유하는 코드 부분은 버그 수정 외에는 큰 차이가 없다고 생각하며 ZBB의 경우 5/10을 목표로 하고 있습니다. Sgen에만 있는 코드 부분의 경우 수행해야 할 기능 작업이 더 있지만 릴리스 차량이 다르기 때문에 더 많은 여유가 있어야 합니다. 이것이 명확해지기를 바랍니다.

@erozenfeld 나머지 삭제 가능한 코드의 대부분은 아무도 사용하지 않는 공통 공유 파일의 일부일 수 있습니다. 각각을 손으로 분석하거나 귀찮은 CSV 결합을 수행하지 않고는 해당 코드를 정리할 수 없습니다. 전체 어셈블리 집합에 대해 ILLink를 실행하여 여러 어셈블리에서 사용되는 파일을 통합하는 간단한 방법이 있습니까? 따라서 공통 코드에서 무엇이 중단되었는지 보여주는 이러한 HTML 보고서 중 하나를 얻을 수 있습니까?

또한 일부 테스트가 제품 코드(예: PathInternal.cs)에서 컴파일될 때 테스트 어셈블리에서 병합하고 싶습니다. 또한 Unix는 물론 공통 코드를 사용하기 때문입니다.

@danmosemsft 내 도구가 그렇게 할 수 있습니다. 즉, 전체 코드 기반에서 실행하여 가양성을 포함한 행을 자동으로 삭제하고 반복적으로 빌드하고 되돌린 다음 테스트합니다. 마지막으로 내 Github 계정으로 푸시하고 풀 요청을 만듭니다. 아마도 꽤 많은 작업이 수반되지만 사용되지 않는 한 시도하지 않습니다. 하위 집합에 대한 결과는 https://github.com/dotnet/corefx/pull/18395 를 참조하세요.

@danmosemsft

전체 어셈블리 집합에 대해 ILLink를 실행하여 여러 어셈블리에서 사용되는 파일을 통합하는 간단한 방법이 있습니까? 따라서 공통 코드에서 무엇이 중단되었는지 보여주는 이러한 HTML 보고서 중 하나를 얻을 수 있습니까?

아니요, 그렇게 하는 직접적인 방법은 없습니다. ILLink는 어셈블리를 생성하는 데 사용되는 소스 파일이 아니라 어셈블리에서 작동합니다.

@erozenfeld 나는 그것이 내가 의미한 바가 아니라고 생각합니다. ILLink가 소스를 통해 작동할 것으로 기대하지 않습니다. 그러나 지금 바이너리 X에서 죽은 것으로 표시되는 공유 소스는 바이너리 Y 또는 Z에서 사용될 수 있기 때문에 쉽게 삭제할 수 없습니다. 개념적으로 모든 라이브러리가 ILMerge 또는 이와 유사한 것과 같은 하나의 큰 dll로 컴파일된 경우, pdb를 적절하게 수정하면 죽은 것으로 표시되는 모든 공통 코드를 삭제할 수 있습니다. 내 질문은 ILMerge가 어셈블리를 하나로 병합한 다음 해당 어셈블리에 대해 클로저 분석을 실행할 수 있는지 여부였습니다.

@danmosemsft 아니요, ILLink는 ILMerge처럼 어셈블리를 하나로 병합할 수 없습니다. ILMerge가 어셈블리 간에 충돌하는 이름을 처리하는 방법을 모르겠습니다. 어셈블리 A에 클래스 NC가 있고 어셈블리 B에 클래스 NC가 있는 경우 일반적으로 깊은 의미에서 동일하다는 것을 증명할 수 없다면 병합할 때 둘 다 유지(그리고 하나 또는 둘 다 이름을 바꿉니다)해야 합니다.

잡았다. 글쎄요 아마도 접근 방식이 미래에 나타날 것입니다. 별거 아니야.

그것은 또한 CSV의 일부 처리로 수행 될 수 있다고 생각합니다 ...

이 모든 데이터는 현재 오래된 것일 수 있습니다. 이에 대해 더 많은 작업을 수행하려면 보고서를 다시 실행해야 합니다. 위의 배경 섹션에서 이를 수행하는 방법에 대한 지침을 찾을 수 있습니다.

System.Collections.Immutable 및 System.Collections.NonGeneric에서 플래그가 지정된 유일한 코드는 동일한 클래스의 다른 메서드가 해당 프로젝트에서 사용되는 공통 파일의 메서드 또는 상수를 사용하므로 추가 작업이 필요하지 않습니다.

@YoupHulsebos 감사합니다. 상위 게시물이 업데이트되었습니다.

System.IO.FileSystem.Watcher 및 System.Security.Cryptography.Primitives에서 플래그가 지정된 유일한 코드는 동일한 클래스의 다른 메서드가 해당 프로젝트에서 사용되는 공통 파일의 메서드 또는 상수를 사용하는 것이므로 추가 작업이 필요하지 않습니다.

@yaelkeemink 감사합니다 업데이트된 체크박스.

안녕하세요,
첫 기여자로서 괜찮으시다면 System.Net.Mail 라이브러리에 도전하고 싶습니다!

감사합니다! 가세요. 장애물에 부딪히면 여기에서 새 문제 파일에 대해 ping을 보내주십시오(라우팅을 위해 저를 태그).

System.Net.Mail에 대한 풀 요청을 만들고 계약에 서명했습니다.

@Ermiar 감사합니다! PR에 대한 링크로 업데이트된 주요 문제.

여기 처음 온 사람 - 다음을 가져갈 것입니다.

시스템.IO.파일시스템.드라이브 정보
System.IO.FileSystem.Watcher

🗄

굉장합니다. @garfbradaz에 오신 것을 환영합니다!
PR을 제출할 때 알려주시면 상위 게시물을 업데이트하겠습니다( @ViktorHofer 오늘 도와주시겠습니까?)

확신하는.

@garfbradaz 가능한 데드 코드를 제거한 후 Desktop 및 Core에 대한 두 프로젝트 모두에서 모든 테스트를 실행하는지 확인하십시오.
먼저 다음을 실행하여 이 작업을 수행할 수 있습니다.
corefx 루트에서 build.cmdbuild.cmd -framework:netfx 를 실행한 후 다음과 같이 개별 테스트 프로젝트를 실행합니다.
msbuild /t:RebuildAndTestmsbuild /t:RebuildAndTest /p:TargetGroup=netfx .

도움이 필요하면 주저하지 말고 저에게 연락하세요. 당신의 도움을 주셔서 감사합니다!

감사 합니다 @ViktorHofer / @karelz - 천천히 쟁기질

가양성이 있습니다. dotnet/corefx#19826은 이 문제에 대한 커밋 81506698에 의해 제거된 코드로 구현됩니다. 현재로서는 메서드가 '죽었지만' DbProviderFactories를 .NET 전체에서 다시 가져오는 것이 중요합니다. 따라서 dotnet/corefx#19826의 PR이 병합되면 부활합니다.

처음으로 기여한 사람으로서 System.Linq.Expressions에서 스윙을 하고 싶습니다.

멋지다 @mccbraxton! 도움이 필요하시면 저에게 핑을 보내주세요.

@mccbraxton System.Linq.Expressions가 이미 정리된 것 같습니다. 다른 조각을 가져갈래?

@ViktorHofer 당신이 옳았습니다 - 잘못 읽었을 것입니다. System.Security.Cryptography.Algorithms는 어떻습니까?

좋아 보인다! 나는 당신을 테이블에 추가했습니다. 대상에서 사용하는 코드를 삭제하지 않도록 하십시오. 당신의 도움을 주셔서 감사합니다!

dotnet/corefx#18162는 진정으로 죽은 Microsoft.CSharp에 대한 보고서에 남아 있는 것을 처리했습니다.

안녕하세요 new contrib 여기에 System.ComponentModel을 사용할 수 있습니다.*

@norek 감사합니다.

안녕하세요 System.ComponentModel 요약입니다.

  • 루트 - 제거할 항목 없음
  • .주석 - 제거할 항목 없음
  • .EventBasedAsync - 제거할 항목 없음
  • .Primitives - 죽은 것으로 표시되지만 그렇지는 않습니다.
  • .TypeConverters - 일부 코드를 제거합니다. 하지만 != 연산자와 혼동됩니다. 죽은 것으로 표시되지만 모든 코딩 규칙을 모릅니다. 삭제해야 합니까?

목록을 검토하고 System.Diagnostics에서 죽은 코드를 발견했습니다 StackTraceSymbols 는 죽은 것으로 표시되지만 솔루션 탐색기에서 이 클래스의 이름은 StackTraceSymbols.CoreCLR.cs 입니다. 닫힌 문제에서 찾았습니다: dotnet/corefx#19368
그리고 죽었는지 아닌지?

@mikem8361 SDStackTraceSymbols 를 소유하고 있습니까?

나는 그것을 소유하고 그것은 죽은 코드가 아닙니다. 반사는 System.Private.CoreLib에서 이 어셈블리를 로드하고 이 클래스를 참조하는 데 사용됩니다.

따라서 coreclr은 처리되지 않은 예외 스택 추적에 대한 소스/라인 번호 정보를 인쇄할 수 있습니다.

@mikem8361 정보 감사합니다. illlinktrim.xml에 의해 보호되는 것 같습니다.

<linker>
  <assembly fullname="System.Diagnostics.StackTrace">
    <!-- used by System.Private.CoreLib StackTrace code to load portable pdbs for the runtime diagnostic stack trace to get source/line info -->
    <type fullname="System.Diagnostics.StackTraceSymbols" required="true" />
  </assembly>
</linker>

@ericstj @erozenfeld ILLink 가 내보내는 CSV를 수정하여 코드를 유지하도록 강제할 때 코드가 죽은 것으로 표시 되지 않도록 할 수 있습니까?

우리가 가지고 있는 CSV는 트리밍 후의 차이일 뿐이므로 명시적으로 뿌리를 둔 항목이 없습니다. 이번 호에 링크된 데이터는 라이브가 아닙니다. 문제를 열었을 때 일회성 실행에서 나온 것입니다. 나는 당신이 라이브 정보를 본다면 더 이상 diff로 표시되지 않을 것이라고 생각합니다.

안녕하세요 처음으로 글을 쓰는 사람입니다. System.Net.Http 및 System.Net.HttpListener를 시도하고 싶습니다.

@soapdogg 힘내세요 ..

@AlexGhiondea 언급된 대로

여보세요. Microsoft.VisulaBasic 받을 수 있습니까?

@satano 확실히 하세요. 제거할 비트가 몇 개뿐인 것 같습니다(위의 내 글에 따라 모든 const 필드와 매개변수가 없는 ctor는 유지해야 함). 아마도 CSharp도 할 수 있습니까?

위의 분석이 완료된 이후 새로운 라이브러리도 있습니다...

좋아, 나는 CSharp와 VisualBasic을 할 것이다.

Microsoft.VisualBasic 에 대한 홍보가 준비되었습니다.

Microsoft.CSharp 관련 - diff 파일의 모든 빨간색이 이미 제거되었습니다. 따라서 문제에 표시하십시오.

이 문제를 처음 사용하는 사람에게 맡길 것입니까, 아니면 계속할 수 있습니까?

@satano 빨간색 diff를 제거한 변경 사항을 찾을 수 있습니까?
계속해도 됩니다. 처음 사용하는 사용자만을 위해 저장하지 않습니다.

그게 전부인지는 모르겠지만 여기에서 뭔가가 제거되었습니다: https://github.com/dotnet/corefx/commit/3eb339702e2fcdf924b50c2e32d7e9e02395e52f

@JonHanna 는 여기 https://github.com/dotnet/corefx/issues/17905#issuecomment -291924301에서도 말했습니다.

위에서부터 계속하겠습니다. 다음에는 System.IO.Compression , System.IO.FileSystem.AccessControl , System.IO.FileSystem 를 사용하겠습니다.

@satano 가세요 -- 허가를 요청할 필요가 없습니다. 다른 사람이 찾고 있다면 여기에 게시할 것입니다.

누군가에게 흥미로운 "메타 문제" 중 하나는 동일한 링커 도구를 사용하여 아무도 사용하지 않는 공통 코드를 찾는 방법이 있는지 여부입니다. srccommon에서 가져온 클래스가 라이브러리에서 부분적으로만 사용되는 경우 이 분석에서는 죽은 것으로 표시되지만 다른 라이브러리에서 가져와서 사용할 수 있기 때문에 제거할 수 없습니다. 내가 생각한 것은 어셈블리를 병합한 다음 링커를 실행하는 방법이 있는지 여부입니다. @erozenfeld 링커를 사용하여 병합한 다음 결과에서 데드 코드를 찾을 수 있습니까?

ILLink는 현재 어셈블리를 병합할 수 없습니다. 이것은 우리가 미래에 추가하는 것을 고려하고 있는 것입니다. 이를 수행할 수 있는 다른 도구가 있습니다: https://github.com/Microsoft/ILMergehttps://github.com/gluck/il-repack 비록 그들이 이 시나리오를 우리가 원하는 방식으로 처리하는지 확실하지 않지만. 그들은 충돌하는 이름을 가진 유형/메서드/필드가 동일한 엔티티를 나타낸다는 것을 깨닫거나 깨닫지 못할 수 있습니다.

계속 System.Net.Http , System.Net.HttpListenerSystem.Net.NetworkInformation .

System.Net.* 전체를 하나씩 가져갑니다.

나머지는 System.Private.* , System.Runtime.*System.Security.* 입니다.

@karelz

... red diff를 제거한 변경 사항을 찾을 수 있습니까?

닷넷/corefx#18162

음... 아마도 이 문제를 검토하고 닫을 시간이 되었습니까?

이 프로젝트의 데드 코드가 제거되고 병합되었습니다.

  • Microsoft.CSharp(위의 주석에서 언급한 대로 이미 이전에 완료됨)
  • Microsoft.VisualBasic
  • 시스템.IO.압축
  • 시스템.IO.파일시스템
  • System.IO.FileSystem.AccessControl
  • 시스템.넷.Http
  • System.Net.HttpListener
  • System.Net.Network정보
  • System.Net.Primitives
  • System.Net.요청
  • System.Net.Security
  • System.Net.Sockets
  • System.Net.WebClient
  • System.Net.WebSocket.Client
  • System.Private.DataContractSerialization
  • System.Private.Uri
  • System.Security.Cryptography.Cng
  • System.Security.Cryptography.Csp

나는 또한 나머지 프로젝트를 보았고 그들에서 할 일이 없습니다.

  • System.Net.WebHeaderCollection
  • System.Net.WebSockets
  • 시스템.런타임
  • System.Runtime.Serialization.Primitives
  • 시스템.보안.접근제어
  • 시스템.보안.클레임
  • System.Security.Cryptography.Algorithms
  • System.Security.Cryptography.Encoding
  • System.Security.Cryptography.OpenSsl

따라서 남은 프로젝트는 Microsoft.XmlSerializer.Generator 뿐입니다. 그것은 죽은 코드의 대부분을 가지고 있지만 여기 일부 주석에서 언급했듯이 거기에는 진행 중인 작업이 있습니다.

이 문제가 완료되었습니까? 그렇지 않다면 System.Console 를 받을 수 있습니까?

@Iroca88 그렇군요 . 위에 링크된 덤프는 지금은 약간 구식일 수 있습니다.

@danmosemsft 에게 감사드립니다. 새 덤프를 얻는 방법에 대한 제안이 있습니까? 그렇지 않으면 위에 제공된 덤프부터 시작하겠습니다.

BTW: is @lroca88 , 이러한 유형의 혼동을 피하기 위해 첫 글자(L)를 대문자로 표시했습니다. :)

@Lroca88 상단 게시물은 트리밍 및 사전 트리밍된 어셈블리에 액세스하는 방법을 설명합니다. 그것들을 구별하기 위해 우리는 공개되지 않은 도구를 사용했습니다. Ilspy On과 같은 디컴파일러를 둘 다 사용하고 결과에 대해 텍스트 비교를 수행할 수 있습니다. 아마 효과가 있을 것입니다.

최근 diff를 실행하여 공유하겠습니다. 계속 지켜봐 주세요.

최신 정보는 다음과 같습니다.

  • [ ] [Microsoft.CSharp](http://tempcoverage.blob.core.windows.net/report3/Microsoft.CSharp.diff.html) ( csv )
  • [ ] [Microsoft.VisualBasic](http://tempcoverage.blob.core.windows.net/report3/Microsoft.VisualBasic.diff.html) ( csv )
  • [ ] [Microsoft.Win32.Primitives](http://tempcoverage.blob.core.windows.net/report3/Microsoft.Win32.Primitives.diff.html) ( csv )
  • [ ] [Microsoft.Win32.Registry](http://tempcoverage.blob.core.windows.net/report3/Microsoft.Win32.Registry.diff.html) ( csv )
  • [ ] [System.Collections.Concurrent](http://tempcoverage.blob.core.windows.net/report3/System.Collections.Concurrent.diff.html) ( csv )
  • [ ] [System.Collections](http://tempcoverage.blob.core.windows.net/report3/System.Collections.diff.html) ( csv )
  • [ ] [System.Collections.Immutable](http://tempcoverage.blob.core.windows.net/report3/System.Collections.Immutable.diff.html) ( csv )
  • [ ] [System.Collections.NonGeneric](http://tempcoverage.blob.core.windows.net/report3/System.Collections.NonGeneric.diff.html) ( csv )
  • [ ] [System.Collections.Specialized](http://tempcoverage.blob.core.windows.net/report3/System.Collections.Specialized.diff.html) ( csv )
  • [ ] [System.ComponentModel.Annotations](http://tempcoverage.blob.core.windows.net/report3/System.ComponentModel.Annotations.diff.html) ( csv )
  • [ ] [System.ComponentModel](http://tempcoverage.blob.core.windows.net/report3/System.ComponentModel.diff.html) ( csv )
  • [ ] [System.ComponentModel.EventBasedAsync](http://tempcoverage.blob.core.windows.net/report3/System.ComponentModel.EventBasedAsync.diff.html) ( csv )
  • [ ] [System.ComponentModel.Primitives](http://tempcoverage.blob.core.windows.net/report3/System.ComponentModel.Primitives.diff.html) ( csv )
  • [ ] [System.ComponentModel.TypeConverter](http://tempcoverage.blob.core.windows.net/report3/System.ComponentModel.TypeConverter.diff.html) ( csv )
  • [ ] [시스템.콘솔](http://tempcoverage.blob.core.windows.net/report3/System.Console.diff.html) ( csv )
  • [ ] [System.Data.Common](http://tempcoverage.blob.core.windows.net/report3/System.Data.Common.diff.html) ( csv )
  • [ ] [System.Diagnostics.DiagnosticSource](http://tempcoverage.blob.core.windows.net/report3/System.Diagnostics.DiagnosticSource.diff.html) ( csv )
  • [ ] [System.Diagnostics.FileVersionInfo](http://tempcoverage.blob.core.windows.net/report3/System.Diagnostics.FileVersionInfo.diff.html) ( csv )
  • [ ] [System.Diagnostics.Process](http://tempcoverage.blob.core.windows.net/report3/System.Diagnostics.Process.diff.html) ( csv )
  • [ ] [System.Diagnostics.StackTrace](http://tempcoverage.blob.core.windows.net/report3/System.Diagnostics.StackTrace.diff.html) ( csv )
  • [ ] [System.Diagnostics.TextWriterTraceListener](http://tempcoverage.blob.core.windows.net/report3/System.Diagnostics.TextWriterTraceListener.diff.html) ( csv )
  • [ ] [System.Diagnostics.Tools](http://tempcoverage.blob.core.windows.net/report3/System.Diagnostics.Tools.diff.html) ( csv )
  • [ ] [System.Diagnostics.TraceSource](http://tempcoverage.blob.core.windows.net/report3/System.Diagnostics.TraceSource.diff.html) ( csv )
  • [ ] [System.Diagnostics.Tracing](http://tempcoverage.blob.core.windows.net/report3/System.Diagnostics.Tracing.diff.html) ( csv )
  • [ ] [System.Drawing.Primitives](http://tempcoverage.blob.core.windows.net/report3/System.Drawing.Primitives.diff.html) ( csv )
  • [ ] [System.IO.Compression.Brotli](http://tempcoverage.blob.core.windows.net/report3/System.IO.Compression.Brotli.diff.html) ( csv )
  • [ ] [시스템.IO.압축](http://tempcoverage.blob.core.windows.net/report3/System.IO.Compression.diff.html) ( csv )
  • [ ] [System.IO.Compression.ZipFile](http://tempcoverage.blob.core.windows.net/report3/System.IO.Compression.ZipFile.diff.html) ( csv )
  • [ ] [System.IO.FileSystem.AccessControl](http://tempcoverage.blob.core.windows.net/report3/System.IO.FileSystem.AccessControl.diff.html) ( csv )
  • [ ] [System.IO.FileSystem](http://tempcoverage.blob.core.windows.net/report3/System.IO.FileSystem.diff.html) ( csv )
  • [ ] [System.IO.FileSystem.DriveInfo](http://tempcoverage.blob.core.windows.net/report3/System.IO.FileSystem.DriveInfo.diff.html) ( csv )
  • [ ] [System.IO.FileSystem.Watcher](http://tempcoverage.blob.core.windows.net/report3/System.IO.FileSystem.Watcher.diff.html) ( csv )
  • [ ] [System.IO.IsolatedStorage](http://tempcoverage.blob.core.windows.net/report3/System.IO.IsolatedStorage.diff.html) ( csv )
  • [ ] [System.IO.MemoryMappedFiles](http://tempcoverage.blob.core.windows.net/report3/System.IO.MemoryMappedFiles.diff.html) ( csv )
  • [ ] [System.IO.Pipes](http://tempcoverage.blob.core.windows.net/report3/System.IO.Pipes.diff.html) ( csv )
  • [ ] [System.Linq](http://tempcoverage.blob.core.windows.net/report3/System.Linq.diff.html) ( csv )
  • [ ] [System.Linq.Expressions](http://tempcoverage.blob.core.windows.net/report3/System.Linq.Expressions.diff.html) ( csv )
  • [ ] [System.Linq.Parallel](http://tempcoverage.blob.core.windows.net/report3/System.Linq.Parallel.diff.html) ( csv )
  • [ ] [System.Linq.Queryable](http://tempcoverage.blob.core.windows.net/report3/System.Linq.Queryable.diff.html) ( csv )
  • [ ] [시스템 메모리](http://tempcoverage.blob.core.windows.net/report3/System.Memory.diff.html) ( csv )
  • [ ] [시스템넷.Http](http://tempcoverage.blob.core.windows.net/report3/System.Net.Http.diff.html) ( csv )
  • [ ] [System.Net.HttpListener](http://tempcoverage.blob.core.windows.net/report3/System.Net.HttpListener.diff.html) ( csv )
  • [ ] [System.Net.Mail](http://tempcoverage.blob.core.windows.net/report3/System.Net.Mail.diff.html) ( csv )
  • [ ] [System.Net.NameResolution](http://tempcoverage.blob.core.windows.net/report3/System.Net.NameResolution.diff.html) ( csv )
  • [ ] [System.Net.NetworkInformation](http://tempcoverage.blob.core.windows.net/report3/System.Net.NetworkInformation.diff.html) ( csv )
  • [ ] [System.Net.Ping](http://tempcoverage.blob.core.windows.net/report3/System.Net.Ping.diff.html) ( csv )
  • [ ] [System.Net.Primitives](http://tempcoverage.blob.core.windows.net/report3/System.Net.Primitives.diff.html) ( csv )
  • [ ] [System.Net.Requests](http://tempcoverage.blob.core.windows.net/report3/System.Net.Requests.diff.html) ( csv )
  • [ ] [System.Net.Security](http://tempcoverage.blob.core.windows.net/report3/System.Net.Security.diff.html) ( csv )
  • [ ] [System.Net.ServicePoint](http://tempcoverage.blob.core.windows.net/report3/System.Net.ServicePoint.diff.html) ( csv )
  • [ ] [System.Net.Sockets](http://tempcoverage.blob.core.windows.net/report3/System.Net.Sockets.diff.html) ( csv )
  • [ ] [시스템넷.웹클라이언트](http://tempcoverage.blob.core.windows.net/report3/System.Net.WebClient.diff.html) ( csv )
  • [ ] [System.Net.WebHeaderCollection](http://tempcoverage.blob.core.windows.net/report3/System.Net.WebHeaderCollection.diff.html) ( csv )
  • [ ] [System.Net.WebProxy](http://tempcoverage.blob.core.windows.net/report3/System.Net.WebProxy.diff.html) ( csv )
  • [ ] [System.Net.WebSockets.Client](http://tempcoverage.blob.core.windows.net/report3/System.Net.WebSockets.Client.diff.html) ( csv )
  • [ ] [시스템넷.웹소켓](http://tempcoverage.blob.core.windows.net/report3/System.Net.WebSockets.diff.html) ( csv )
  • [ ] [System.Numerics.Vectors](http://tempcoverage.blob.core.windows.net/report3/System.Numerics.Vectors.diff.html) ( csv )
  • [ ] [시스템 개체 모델](http://tempcoverage.blob.core.windows.net/report3/System.ObjectModel.diff.html) ( csv )
  • [ ] [System.Private.DataContractSerialization](http://tempcoverage.blob.core.windows.net/report3/System.Private.DataContractSerialization.diff.html) ( csv )
  • [ ] [System.Private.Uri](http://tempcoverage.blob.core.windows.net/report3/System.Private.Uri.diff.html) ( csv )
  • [ ] [System.Private.Xml](http://tempcoverage.blob.core.windows.net/report3/System.Private.Xml.diff.html) ( csv )
  • [ ] [System.Private.Xml.Linq](http://tempcoverage.blob.core.windows.net/report3/System.Private.Xml.Linq.diff.html) ( csv )
  • [ ] [System.Reflection.DispatchProxy](http://tempcoverage.blob.core.windows.net/report3/System.Reflection.DispatchProxy.diff.html) ( csv )
  • [ ] [System.Reflection.Metadata](http://tempcoverage.blob.core.windows.net/report3/System.Reflection.Metadata.diff.html) ( csv )
  • [ ] [System.Reflection.TypeExtensions](http://tempcoverage.blob.core.windows.net/report3/System.Reflection.TypeExtensions.diff.html) ( csv )
  • [ ] [System.Resources.Writer](http://tempcoverage.blob.core.windows.net/report3/System.Resources.Writer.diff.html) ( csv )
  • [ ] [System.Runtime.CompilerServices.VisualC](http://tempcoverage.blob.core.windows.net/report3/System.Runtime.CompilerServices.VisualC.diff.html) ( csv )
  • [ ] [시스템 런타임](http://tempcoverage.blob.core.windows.net/report3/System.Runtime.diff.html) ( csv )
  • [ ] [System.Runtime.Extensions](http://tempcoverage.blob.core.windows.net/report3/System.Runtime.Extensions.diff.html) ( csv )
  • [ ] [System.Runtime.InteropServices](http://tempcoverage.blob.core.windows.net/report3/System.Runtime.InteropServices.diff.html) ( csv )
  • [ ] [System.Runtime.InteropServices.RuntimeInformation](http://tempcoverage.blob.core.windows.net/report3/System.Runtime.InteropServices.RuntimeInformation.diff.html)( csv )
  • [ ] [System.Runtime.InteropServices.WindowsRuntime](http://tempcoverage.blob.core.windows.net/report3/System.Runtime.InteropServices.WindowsRuntime.diff.html) ( csv )
  • [ ] [시스템.런타임.숫자](http://tempcoverage.blob.core.windows.net/report3/System.Runtime.Numerics.diff.html) ( csv )
  • [ ] [System.Runtime.Serialization.Formatters](http://tempcoverage.blob.core.windows.net/report3/System.Runtime.Serialization.Formatters.diff.html) ( csv )
  • [ ] [System.Runtime.Serialization.Primitives](http://tempcoverage.blob.core.windows.net/report3/System.Runtime.Serialization.Primitives.diff.html) ( csv )
  • [ ] [System.Security.AccessControl](http://tempcoverage.blob.core.windows.net/report3/System.Security.AccessControl.diff.html) ( csv )
  • [ ] [System.Security.Claims](http://tempcoverage.blob.core.windows.net/report3/System.Security.Claims.diff.html) ( csv )
  • [ ] [System.Security.Cryptography.Algorithms](http://tempcoverage.blob.core.windows.net/report3/System.Security.Cryptography.Algorithms.diff.html) ( csv )
  • [ ] [System.Security.Cryptography.Cng](http://tempcoverage.blob.core.windows.net/report3/System.Security.Cryptography.Cng.diff.html) ( csv )
  • [ ] [System.Security.Cryptography.Csp](http://tempcoverage.blob.core.windows.net/report3/System.Security.Cryptography.Csp.diff.html) ( csv )
  • [ ] [System.Security.Cryptography.Encoding](http://tempcoverage.blob.core.windows.net/report3/System.Security.Cryptography.Encoding.diff.html) ( csv )
  • [ ] [System.Security.Cryptography.OpenSsl](http://tempcoverage.blob.core.windows.net/report3/System.Security.Cryptography.OpenSsl.diff.html) ( csv )
  • [ ] [System.Security.Cryptography.Primitives](http://tempcoverage.blob.core.windows.net/report3/System.Security.Cryptography.Primitives.diff.html) ( csv )
  • [ ] [System.Security.Cryptography.X509Certificates](http://tempcoverage.blob.core.windows.net/report3/System.Security.Cryptography.X509Certificates.diff.html) ( csv )
  • [ ] [System.Security.Principal](http://tempcoverage.blob.core.windows.net/report3/System.Security.Principal.diff.html) ( csv )
  • [ ] [System.Security.Principal.Windows](http://tempcoverage.blob.core.windows.net/report3/System.Security.Principal.Windows.diff.html) ( csv )
  • [ ] [System.Text.RegularExpressions](http://tempcoverage.blob.core.windows.net/report3/System.Text.RegularExpressions.diff.html) ( csv )
  • [ ] [시스템 스레딩](http://tempcoverage.blob.core.windows.net/report3/System.Threading.diff.html) ( csv )
  • [ ] [System.Threading.Overlapped](http://tempcoverage.blob.core.windows.net/report3/System.Threading.Overlapped.diff.html) ( csv )
  • [ ] [System.Threading.Tasks.Dataflow](http://tempcoverage.blob.core.windows.net/report3/System.Threading.Tasks.Dataflow.diff.html) ( csv )
  • [ ] [System.Threading.Tasks.Parallel](http://tempcoverage.blob.core.windows.net/report3/System.Threading.Tasks.Parallel.diff.html) ( csv )
  • [ ] [System.Threading.Thread](http://tempcoverage.blob.core.windows.net/report3/System.Threading.Thread.diff.html) ( csv )
  • [ ] [System.Transactions.Local](http://tempcoverage.blob.core.windows.net/report3/System.Transactions.Local.diff.html) ( csv )
  • [ ] [System.ValueTuple](http://tempcoverage.blob.core.windows.net/report3/System.ValueTuple.diff.html) ( csv )
  • [ ] [System.Web.HttpUtility](http://tempcoverage.blob.core.windows.net/report3/System.Web.HttpUtility.diff.html) ( csv )
  • [ ] [System.Xml.XPath.XDocument](http://tempcoverage.blob.core.windows.net/report3/System.Xml.XPath.XDocument.diff.html) ( csv )

멋지다, 나는 예전 목록과 씨름하고 있었다! 🔨

@Lroca88 이 패스를 수행하는 방법에 대한 상위 게시물 힌트를 읽고 혼란을 줄이십시오..

죄송합니다. dotnet/corefx#26491의 Microsoft.CSharp에서 새로 분리된 두 비트를 놓쳤습니다. 나는 곧 그것을 얻을 것이다.

새 목록에서 System.Runtime, System.Web.HttpUtility, System.Linq 및 System.Linq.Queryable에는 실제로 죽지 않은 상수와 일부 공유 코드만 있습니다. System.Linq.Expressions에는 특정 컴파일러 상수와 함께 사용되는 디버그 보기 및 리소스에 사용되는 항목과 몇 가지 항목이 있으므로 제거해야 하므로 해당 5개를 모두 선택 해제할 수 있습니다.

@JonHanna 가 검토한 라이브러리와 내가 검토한 라이브러리를 목록으로 병합했습니다. 시간이 허락하는 한 계속 목록을 업데이트하겠습니다. 누군가 이 목록에 항목을 추가하고 싶다면 언제든지 저에게 핑을 보내주세요!

도서관 | 검토자 | 상태
-- | -- | --
Microsoft.CSharp(csv) | @JonHanna | 닷넷/corefx#27104
Microsoft.VisualBasic(csv) | @Lroca88 | 제거할 항목 없음
Microsoft.Win32.Primitives(csv) | @Lroca88 | 제거할 항목 없음
Microsoft.Win32.Registry(csv) | @Lroca88 | 제거할 항목 없음
System.Collections.Concurrent(csv) | @Lroca88 | 제거할 항목 없음
System.Collections(csv) | @Lroca88 | 제거할 항목 없음
시스템.런타임(csv) | @JonHanna | 제거할 항목 없음
System.Web.HttpUtility(csv) | @JonHanna | 제거할 항목 없음
System.Linq(csv) | @JonHanna | 제거할 항목 없음
System.Linq.Queryable(csv) | @JonHanna | 제거할 항목 없음

@Lroca88 감사합니다!

죽은 코드가 많이 남아 있지 않다는 것은 놀라운 일이 아닙니다. 그러나 맨 위에 언급된 것처럼 이 프로세스는 srccommon의 코드가 죽은 것인지 여부를 결정할 수 없습니다(한 어셈블리에서는 죽은 것으로 표시되지만 다른 어셈블리에서는 표시되지 않을 수 있기 때문에). 이 문제를 해결하는 방법을 찾는 데 관심이 있다면 죽은 코드를 더 많이 찾을 수 있습니다. 예를 들어 어셈블리를 ILMerge한 다음 데드 코드 분석을 실행할 수 있습니다. 또는 CSV를 사후 처리하여 모두에서 죽은 공통 코드를 찾는 것이 더 쉬울 수 있습니다. @ericstj 아이디어가 있었나요?

@danmosemsft 를 도와드릴 수 있어 기쁩니다.
내 리뷰에서 이 프로세스를 개선하는 것에 대해 귀하의 의견에 동의합니다. 가장 플래그가 지정된 코드는 죽지 않았거나, 이전에 말했듯이 const이거나 다른 어셈블리에서 자주 사용됩니다. 그 오탐을 보는 것은 내 생각에 사냥을 약간 지루하게 만듭니다.

불행히도 ILMerge 및 데드 코드 분석을 수행하거나 CSV를 사후 처리하는 방법을 모르겠습니다. 여러분이 저를 가르치는 데 시간을 할애하고 싶다면 기꺼이 배우거나 협력할 의향이 있습니다. :)

우리는 어디에 있습니까? OP가 완료된 수업과 함께 최신 상태로 유지되고 있습니까, 아니면 지금 이 의견 을 종료해야 합니까?

@MisinformedDNA -- https://github.com/dotnet/corefx/issues/17905#issuecomment -365349091을 사용하세요.

ILMerge 및 데드 코드 분석을 수행하거나 CSV를 사후 처리하는 방법을 모르겠습니다. 여러분이 저를 가르치는 데 시간을 할애하고 싶다면 기꺼이 배우거나 협력할 의향이 있습니다. :)

나도 모르고 생각/실험을 해야 합니다. 지금은 2.1 릴리스를 종료하는 데 전념하고 있으므로 조금 기다려야 합니다 😺

모든 CSV를 로드하는 스크립트를 작성한 다음 가장 실행 가능한 것으로 필터링했습니다. 나는 3,942개의 문제/기회를 생각해 냈습니다.

이제 각 문제를 살펴보고 적절한 조치를 취하려고 합니다. https://github.com/MisinformedDNA/corefx/tree/clean-dead-code 에서 내 진행 상황을 팔로우하고 피드백을 남길 수 있습니다.

이 @MisinformedDNA를 보기를 고대하고 있습니다.

도구에 문제나 결함이 있는 데드 코드 분석 문제를 발견했습니다.

보고서에 따르면 다음을 제거할 수 있습니다.

    Friend Enum vbErrors
        ObjNotSet = 91
        IllegalFor = 92
    End Enum

그러나 이러한 열거형은 다른 곳에서 참조되므로 가능한 분기를 하나 살펴보겠습니다.

    ' Enum cannot be accessed, so Function cannot be hit
    ' But the dead code analysis did not show this as removable!!
    Friend Shared Function VbMakeIllegalForException() As System.Exception
        Return VbMakeExceptionEx(vbErrors.IllegalFor, GetResourceString(SR.ID92)) 
    End Function

    ' The chain continues:

    ' VbMakeIllegalForException() cannot be hit, so first "If" cannot be true, but the rest of the Function *could* still be hit
    Public Shared Function ForNextCheckObj(ByVal counter As Object, ByVal loopObj As Object, ByRef counterResult As Object) As Boolean
        Dim loopFor As ForLoopControl
        If loopObj Is Nothing Then
            Throw VbMakeIllegalForException()
        End If
        If counter Is Nothing Then
            Throw New NullReferenceException(GetResourceString(SR.Argument_InvalidNullValue1, "Counter"))
        End If
        loopFor = CType(loopObj, ForLoopControl)
        ... cut for brevity
    End Function

논리는 나를 첫 번째 "If" 문이 결코 참이 아닌 곳으로 데려갔습니다. 그러나 "If" 문은 null 검사이므로 누군가 null 를 전달하고 데드 코드를 결정하기 위한 누락된 사례가 있다고 가정해야 합니다. 데드 코드를 결정하는 데 문제(또는 그 이상)가 있는 경우 Enum 중 하나 이상이 결국 데드 코드가 아닐 수 있습니다.

tldr: 요약

질문 1: VbMakeIllegalForException이 제거 대상 으로 표시된 열거형을 호출할 수 없음에도 불구하고 제거 대상으로 표시 되지 않은 이유는 무엇입니까?
질문 2: 테스트 케이스가 데드 코드를 결정할 때 적용 가능한 모든 매개변수에 대해 null 값을 전달하지 않는 이유는 무엇입니까?

@ericstj

열거형 값은 아마도 msil에 인라인되어 도구에서 볼 수 없을 것입니다. 상수의 경우에도 마찬가지입니다. 이 경우 소스 코드에 대해 아무 것도 수행해서는 안 됩니다.

방금 build.cmd src\System.Data.Common 가 성공적으로 완료되어 System.Data.Common 에 대한 데드 코드 제거를 완료했습니다. 지금까지는 내가 속해 있는 라이브러리에서만 일을 하고 빌드와 테스트를 통과하면 가도 좋다는 생각을 하고 있었다. 하지만 어쨌든 전체 빌드를 하기로 결정했고 많은 오류가 발생했기 때문에 그렇게 해서 기쁩니다.

다음은 몇 가지 예시 오류입니다.

SystemDataSqlClientSqlCommandBuilder.cs(277,17): 오류 CS0117: 'ADP'에 'RemoveStringQuotes'에 대한 정의가 포함되어 있지 않습니다. [D:ReposcorefxsrcSystem.Data.SqlClientsrcSystem.Data.SqlClient.csproj]
SystemDataProviderBaseDbConnectionPool.cs(984,33): 오류 CS0117: 'ADP'에 'SetCurrentTransaction'에 대한 정의가 포함되어 있지 않습니다. [D:ReposcorefxsrcSystem.Data.SqlClientsrcSystem.Data.SqlClient.csproj]
D:ReposcorefxsrcCommonsrcSystemDataProviderBaseDbMetaDataFactory.cs(409,21): 오류 CS0117: 'ADP'에 'IsEmptyArray'에 대한 정의가 포함되어 있지 않습니다. [D:ReposcorefxsrcSystem.Data.SqlClientsrcSystem.Data.SqlClient.csproj]
SystemDataCommonDbConnectionStringCommon.cs(180,27): 오류 CS0117: 'ADP'에 'InvalidConnectionOptionValue'에 대한 정의가 포함되어 있지 않습니다. [D:ReposcorefxsrcSystem.Data.SqlClientsrcSystem.Data.SqlClient.csproj]

누락된 멤버는 모두 System.Data.Common.diff.html 에서 삭제되도록 명확하게 지정되었지만 하위 클래스에서 오류를 일으킬 뿐만 아니라 이러한 하위 클래스에 대한 diff 파일이 없거나 System.Data.SqlClient 와 같은 관련 어셈블리가 있습니다.

위에 표시된 첫 번째 오류는 공개 메서드 SqlCommandBuilder.UnquoteIdentifier 에 연결됩니다. 따라서 다른 클래스의 주요 변경 사항 없이 System.Data.Common ADP.RemoveStringQuotes 를 제거하는 방법을 알 수 없습니다.

어떻게 처리해야 합니까? 제거 대상으로 표시된 이유에 대한 아이디어가 있습니까?

@anipik 여기서 @misinformeddna 를 도울 수 있습니까?

@MisinformedDNA 한 라이브러리가 다른 라이브러리에 직접(A는 B의 유형을 사용) 또는 간접적으로 종속될 수 있기 때문에 항상 전체 저장소를 빌드하고 모든 라이브러리에 대한 테스트를 실행해야 합니다. (A는 B의 일부 유형을 사용하고 C의 일부 유형을 사용)
ADP.removeStringQuotes , isemptyarray , setTransaction 함수에는 ApaterUtil 또는 System.Data.Common에만 해당하는 기능이 없으므로 sqlCommandBuilder.cs 으로 이동할 수 있습니다.

위에서 언급한 모든 메서드는 internal static methods 이며 정의된 어셈블리에서 더 이상 사용되지 않습니다.
내부 멤버는 일반적으로 정의된 어셈블리 외부에서 사용되지 않습니다. 하지만 어떤 경우에는 ``Internals Visible To``` 속성을 사용하여 그렇게 합니다.

@danmosemsft 는 이러한 내부 기능을 최적으로 사용되는 어셈블리로 이동하고 있습니까?

작업 중인 포크는 다음과 같습니다. https://github.com/MisinformedDNA/corefx/tree/clean-dead-code

이전에 언급했듯이 데드 코드 분석에 따르면 $#$ System.Data.Common ADP.RemoveStringQuotes 는 제거될 수 있습니다. 그러나 ADPinternal $ 로 표시되었으므로 분석기는 어셈블리 외부에서 사용되지 않는다고 가정했을 수 있습니다. InternalsVisibleTo 속성을 찾는지 확실하지 않지만 여기에서 사용되지 않기 때문에 그렇게 했다면 중요하지 않았을 것입니다. 대신 링크된 파일을 통해 공유되고 있습니다.

<Compile Include="$(CommonPath)\System\Data\Common\AdapterUtil.cs">
    <Link>System\Data\Common\AdapterUtil.cs</Link>
</Compile>

본질적으로 복제되고 있기 때문에 분석기가 다른 ADP 클래스를 공유 유형이 아닌 별도의 유형으로 보고 있다고 가정합니다. 따라서 RemoveStringQuotes 를 제거하는 것이 System.Data.Common 에 대해 수행하는 올바른 작업이지만 연결된 다른 프로젝트를 고려할 때 수행하는 잘못된 작업입니다.

분석기가 이러한 모든 클래스가 동일한 파일에서 왔다는 것을 결정할 수 없는 한 우리는 이 파일 중 일부에 데드 코드가 있다고 영원히 생각할 것입니다.

누군가 더 나은 제안을 하지 않는 한 이 메서드를 코드에 다시 추가하겠습니다.

@MisinformedDNA @danmosemsft 오프라인에서 이에 대해 이야기했습니다. 또 다른 가능한 접근 방식은 ADP 클래스를 부분적으로 만드는 것입니다. 그런 다음 이 함수를 이러한 라이브러리로 이동할 수 있습니다.

첫 PR을 제출했지만 2개의 빌드가 실패했습니다. 두 빌드 실패 모두 시간 초과를 나타내는 것 같습니다. 이 문제를 해결하려면 어떤 조치를 취해야 합니까?

https://github.com/dotnet/corefx/pull/28795 참조

System.Private.Uri를 살펴보겠습니다.

다음은 모든 파일을 다운로드하고 결합한 다음 오탐 가능성이 있는 모든 파일을 필터링하기 위해 작성한 입니다. 바라건대, 그것은 다른 사람들에게 도움이 될 것입니다.

@ericstj 데이터를 재생성하여 현재 위치를 보다 명확하게 파악하는 것이 의미가 있습니까?

다음 네임스페이스에서 시작됨:

  • System.Collections.Specialized

    • CompatibleComparer의 속성은 2개뿐이지만 파일은 src/common 이상에서 사용됩니다.

  • System.Diagnostics.DiagnosticSource
  • System.Diagnostics.FileVersionInfo
  • 시스템.진단.프로세스
  • System.Diagnostics.StackTrace
  • System.Diagnostics.TextWriterTraceListener
  • 시스템.진단.도구
  • System.Diagnostics.TraceSource
  • 시스템.진단.추적

데이터를 재생성했습니다. 여기에 새로운 목록이 있습니다. 사람들이 관련성이 있다고 생각할 경우에 대비하여 거기에 있던 것을 덮어쓰고 싶지 않았습니다.

  • [ ] [Microsoft.CSharp](http://tempcoverage.blob.core.windows.net/report4/Microsoft.CSharp.diff.html) ( csv )
  • [ ] [Microsoft.VisualBasic](http://tempcoverage.blob.core.windows.net/report4/Microsoft.VisualBasic.diff.html) ( csv )
  • [ ] [Microsoft.Win32.Primitives](http://tempcoverage.blob.core.windows.net/report4/Microsoft.Win32.Primitives.diff.html) ( csv )
  • [ ] [Microsoft.Win32.Registry](http://tempcoverage.blob.core.windows.net/report4/Microsoft.Win32.Registry.diff.html) ( csv )
  • [ ] [System.Collections.Concurrent](http://tempcoverage.blob.core.windows.net/report4/System.Collections.Concurrent.diff.html) ( csv )
  • [ ] [System.Collections](http://tempcoverage.blob.core.windows.net/report4/System.Collections.diff.html) ( csv )
  • [ ] [System.Collections.Immutable](http://tempcoverage.blob.core.windows.net/report4/System.Collections.Immutable.diff.html) ( csv )
  • [ ] [System.Collections.NonGeneric](http://tempcoverage.blob.core.windows.net/report4/System.Collections.NonGeneric.diff.html) ( csv )
  • [ ] [System.Collections.Specialized](http://tempcoverage.blob.core.windows.net/report4/System.Collections.Specialized.diff.html) ( csv )
  • [ ] [System.ComponentModel.Annotations](http://tempcoverage.blob.core.windows.net/report4/System.ComponentModel.Annotations.diff.html) ( csv )
  • [ ] [System.ComponentModel](http://tempcoverage.blob.core.windows.net/report4/System.ComponentModel.diff.html) ( csv )
  • [ ] [System.ComponentModel.EventBasedAsync](http://tempcoverage.blob.core.windows.net/report4/System.ComponentModel.EventBasedAsync.diff.html) ( csv )
  • [ ] [System.ComponentModel.Primitives](http://tempcoverage.blob.core.windows.net/report4/System.ComponentModel.Primitives.diff.html) ( csv )
  • [ ] [System.ComponentModel.TypeConverter](http://tempcoverage.blob.core.windows.net/report4/System.ComponentModel.TypeConverter.diff.html) ( csv )
  • [ ] [시스템 콘솔](http://tempcoverage.blob.core.windows.net/report4/System.Console.diff.html) ( csv )
  • [ ] [System.Data.Common](http://tempcoverage.blob.core.windows.net/report4/System.Data.Common.diff.html) ( csv )
  • [ ] [System.Diagnostics.DiagnosticSource](http://tempcoverage.blob.core.windows.net/report4/System.Diagnostics.DiagnosticSource.diff.html) ( csv )
  • [ ] [System.Diagnostics.FileVersionInfo](http://tempcoverage.blob.core.windows.net/report4/System.Diagnostics.FileVersionInfo.diff.html) ( csv )
  • [ ] [System.Diagnostics.Process](http://tempcoverage.blob.core.windows.net/report4/System.Diagnostics.Process.diff.html) ( csv )
  • [ ] [System.Diagnostics.StackTrace](http://tempcoverage.blob.core.windows.net/report4/System.Diagnostics.StackTrace.diff.html) ( csv )
  • [ ] [System.Diagnostics.TextWriterTraceListener](http://tempcoverage.blob.core.windows.net/report4/System.Diagnostics.TextWriterTraceListener.diff.html) ( csv )
  • [ ] [System.Diagnostics.Tools](http://tempcoverage.blob.core.windows.net/report4/System.Diagnostics.Tools.diff.html) ( csv )
  • [ ] [System.Diagnostics.TraceSource](http://tempcoverage.blob.core.windows.net/report4/System.Diagnostics.TraceSource.diff.html) ( csv )
  • [ ] [System.Diagnostics.Tracing](http://tempcoverage.blob.core.windows.net/report4/System.Diagnostics.Tracing.diff.html) ( csv )
  • [ ] [System.Drawing.Primitives](http://tempcoverage.blob.core.windows.net/report4/System.Drawing.Primitives.diff.html) ( csv )
  • [x] [System.IO.Compression.Brotli](http://tempcoverage.blob.core.windows.net/report4/System.IO.Compression.Brotli.diff.html) ( csv )
  • [ ] [System.IO.Compression](http://tempcoverage.blob.core.windows.net/report4/System.IO.Compression.diff.html) ( csv )
  • [ ] [System.IO.Compression.ZipFile](http://tempcoverage.blob.core.windows.net/report4/System.IO.Compression.ZipFile.diff.html) ( csv )
  • [ ] [System.IO.FileSystem.AccessControl](http://tempcoverage.blob.core.windows.net/report4/System.IO.FileSystem.AccessControl.diff.html) ( csv )
  • [ ] [System.IO.FileSystem](http://tempcoverage.blob.core.windows.net/report4/System.IO.FileSystem.diff.html) ( csv )
  • [x] [System.IO.FileSystem.DriveInfo](http://tempcoverage.blob.core.windows.net/report4/System.IO.FileSystem.DriveInfo.diff.html) ( csv )
  • [ ] [System.IO.FileSystem.Watcher](http://tempcoverage.blob.core.windows.net/report4/System.IO.FileSystem.Watcher.diff.html) ( csv )
  • [ ] [System.IO.IsolatedStorage](http://tempcoverage.blob.core.windows.net/report4/System.IO.IsolatedStorage.diff.html) ( csv )
  • [ ] [System.IO.MemoryMappedFiles](http://tempcoverage.blob.core.windows.net/report4/System.IO.MemoryMappedFiles.diff.html) ( csv )
  • [x] [System.IO.Pipes](http://tempcoverage.blob.core.windows.net/report4/System.IO.Pipes.diff.html) ( csv )
  • [ ] [System.Linq](http://tempcoverage.blob.core.windows.net/report4/System.Linq.diff.html) ( csv )
  • [ ] [System.Linq.Expressions](http://tempcoverage.blob.core.windows.net/report4/System.Linq.Expressions.diff.html) ( csv )
  • [ ] [System.Linq.Parallel](http://tempcoverage.blob.core.windows.net/report4/System.Linq.Parallel.diff.html) ( csv )
  • [ ] [System.Linq.Queryable](http://tempcoverage.blob.core.windows.net/report4/System.Linq.Queryable.diff.html) ( csv )
  • [ ] [시스템 메모리](http://tempcoverage.blob.core.windows.net/report4/System.Memory.diff.html) ( csv )
  • [ ] [시스템넷.Http](http://tempcoverage.blob.core.windows.net/report4/System.Net.Http.diff.html) ( csv )
  • [ ] [System.Net.HttpListener](http://tempcoverage.blob.core.windows.net/report4/System.Net.HttpListener.diff.html) ( csv )
  • [ ] [System.Net.Mail](http://tempcoverage.blob.core.windows.net/report4/System.Net.Mail.diff.html) ( csv )
  • [ ] [System.Net.NameResolution](http://tempcoverage.blob.core.windows.net/report4/System.Net.NameResolution.diff.html) ( csv )
  • [ ] [System.Net.NetworkInformation](http://tempcoverage.blob.core.windows.net/report4/System.Net.NetworkInformation.diff.html) ( csv )
  • [ ] [시스템넷.핑](http://tempcoverage.blob.core.windows.net/report4/System.Net.Ping.diff.html) ( csv )
  • [ ] [System.Net.Primitives](http://tempcoverage.blob.core.windows.net/report4/System.Net.Primitives.diff.html) ( csv )
  • [ ] [System.Net.Requests](http://tempcoverage.blob.core.windows.net/report4/System.Net.Requests.diff.html) ( csv )
  • [ ] [System.Net.Security](http://tempcoverage.blob.core.windows.net/report4/System.Net.Security.diff.html) ( csv )
  • [ ] [System.Net.ServicePoint](http://tempcoverage.blob.core.windows.net/report4/System.Net.ServicePoint.diff.html) ( csv )
  • [ ] [System.Net.Sockets](http://tempcoverage.blob.core.windows.net/report4/System.Net.Sockets.diff.html) ( csv )
  • [ ] [시스템넷.웹클라이언트](http://tempcoverage.blob.core.windows.net/report4/System.Net.WebClient.diff.html) ( csv )
  • [ ] [System.Net.WebHeaderCollection](http://tempcoverage.blob.core.windows.net/report4/System.Net.WebHeaderCollection.diff.html) ( csv )
  • [ ] [System.Net.WebProxy](http://tempcoverage.blob.core.windows.net/report4/System.Net.WebProxy.diff.html) ( csv )
  • [ ] [System.Net.WebSockets.Client](http://tempcoverage.blob.core.windows.net/report4/System.Net.WebSockets.Client.diff.html) ( csv )
  • [ ] [System.Net.WebSockets](http://tempcoverage.blob.core.windows.net/report4/System.Net.WebSockets.diff.html) ( csv )
  • [ ] [System.Numerics.Vectors](http://tempcoverage.blob.core.windows.net/report4/System.Numerics.Vectors.diff.html) ( csv )
  • [ ] [시스템 개체 모델](http://tempcoverage.blob.core.windows.net/report4/System.ObjectModel.diff.html) ( csv )
  • [ ] [System.Private.DataContractSerialization](http://tempcoverage.blob.core.windows.net/report4/System.Private.DataContractSerialization.diff.html) ( csv )
  • [ ] [System.Private.Uri](http://tempcoverage.blob.core.windows.net/report4/System.Private.Uri.diff.html) ( csv )
  • [ ] [System.Private.Xml](http://tempcoverage.blob.core.windows.net/report4/System.Private.Xml.diff.html) ( csv )
  • [ ] [System.Private.Xml.Linq](http://tempcoverage.blob.core.windows.net/report4/System.Private.Xml.Linq.diff.html) ( csv )
  • [ ] [System.Reflection.DispatchProxy](http://tempcoverage.blob.core.windows.net/report4/System.Reflection.DispatchProxy.diff.html) ( csv )
  • [ ] [System.Reflection.Metadata](http://tempcoverage.blob.core.windows.net/report4/System.Reflection.Metadata.diff.html) ( csv )
  • [ ] [System.Reflection.TypeExtensions](http://tempcoverage.blob.core.windows.net/report4/System.Reflection.TypeExtensions.diff.html) ( csv )
  • [ ] [System.Resources.Writer](http://tempcoverage.blob.core.windows.net/report4/System.Resources.Writer.diff.html) ( csv )
  • [ ] [System.Runtime.CompilerServices.VisualC](http://tempcoverage.blob.core.windows.net/report4/System.Runtime.CompilerServices.VisualC.diff.html) ( csv )
  • [ ] [시스템 런타임](http://tempcoverage.blob.core.windows.net/report4/System.Runtime.diff.html) ( csv )
  • [ ] [System.Runtime.Extensions](http://tempcoverage.blob.core.windows.net/report4/System.Runtime.Extensions.diff.html) ( csv )
  • [ ] [System.Runtime.InteropServices](http://tempcoverage.blob.core.windows.net/report4/System.Runtime.InteropServices.diff.html) ( csv )
  • [ ] [System.Runtime.InteropServices.RuntimeInformation](http://tempcoverage.blob.core.windows.net/report4/System.Runtime.InteropServices.RuntimeInformation.diff.html) ( csv )
  • [ ] [System.Runtime.InteropServices.WindowsRuntime](http://tempcoverage.blob.core.windows.net/report4/System.Runtime.InteropServices.WindowsRuntime.diff.html) ( csv )
  • [ ] [시스템.런타임.숫자](http://tempcoverage.blob.core.windows.net/report4/System.Runtime.Numerics.diff.html) ( csv )
  • [ ] [System.Runtime.Serialization.Formatters](http://tempcoverage.blob.core.windows.net/report4/System.Runtime.Serialization.Formatters.diff.html) ( csv )
  • [ ] [System.Runtime.Serialization.Primitives](http://tempcoverage.blob.core.windows.net/report4/System.Runtime.Serialization.Primitives.diff.html) ( csv )
  • [ ] [System.Runtime.WindowsRuntime.UI.Xaml](http://tempcoverage.blob.core.windows.net/report4/System.Runtime.WindowsRuntime.UI.Xaml.diff.html) ( csv )
  • [ ] [System.Security.AccessControl](http://tempcoverage.blob.core.windows.net/report4/System.Security.AccessControl.diff.html) ( csv )
  • [ ] [System.Security.Claims](http://tempcoverage.blob.core.windows.net/report4/System.Security.Claims.diff.html) ( csv )
  • [ ] [System.Security.Cryptography.Algorithms](http://tempcoverage.blob.core.windows.net/report4/System.Security.Cryptography.Algorithms.diff.html) ( csv )
  • [ ] [System.Security.Cryptography.Cng](http://tempcoverage.blob.core.windows.net/report4/System.Security.Cryptography.Cng.diff.html) ( csv )
  • [ ] [System.Security.Cryptography.Csp](http://tempcoverage.blob.core.windows.net/report4/System.Security.Cryptography.Csp.diff.html) ( csv )
  • [ ] [System.Security.Cryptography.Encoding](http://tempcoverage.blob.core.windows.net/report4/System.Security.Cryptography.Encoding.diff.html) ( csv )
  • [ ] [System.Security.Cryptography.OpenSsl](http://tempcoverage.blob.core.windows.net/report4/System.Security.Cryptography.OpenSsl.diff.html) ( csv )
  • [ ] [System.Security.Cryptography.Primitives](http://tempcoverage.blob.core.windows.net/report4/System.Security.Cryptography.Primitives.diff.html) ( csv )
  • [ ] [System.Security.Cryptography.X509Certificates](http://tempcoverage.blob.core.windows.net/report4/System.Security.Cryptography.X509Certificates.diff.html) ( csv )
  • [ ] [System.Security.Principal](http://tempcoverage.blob.core.windows.net/report4/System.Security.Principal.diff.html) ( csv )
  • [ ] [System.Security.Principal.Windows](http://tempcoverage.blob.core.windows.net/report4/System.Security.Principal.Windows.diff.html) ( csv )
  • [ ] [System.Text.RegularExpressions](http://tempcoverage.blob.core.windows.net/report4/System.Text.RegularExpressions.diff.html) ( csv )
  • [ ] [시스템 스레딩](http://tempcoverage.blob.core.windows.net/report4/System.Threading.diff.html) ( csv )
  • [ ] [System.Threading.Overlapped](http://tempcoverage.blob.core.windows.net/report4/System.Threading.Overlapped.diff.html) ( csv )
  • [ ] [System.Threading.Tasks.Dataflow](http://tempcoverage.blob.core.windows.net/report4/System.Threading.Tasks.Dataflow.diff.html) ( csv )
  • [ ] [System.Threading.Tasks.Parallel](http://tempcoverage.blob.core.windows.net/report4/System.Threading.Tasks.Parallel.diff.html) ( csv )
  • [ ] [System.Threading.Thread](http://tempcoverage.blob.core.windows.net/report4/System.Threading.Thread.diff.html) ( csv )
  • [ ] [System.Transactions.Local](http://tempcoverage.blob.core.windows.net/report4/System.Transactions.Local.diff.html) ( csv )
  • [ ] [System.Web.HttpUtility](http://tempcoverage.blob.core.windows.net/report4/System.Web.HttpUtility.diff.html) ( csv )
  • [ ] [System.Xml.XPath.XDocument](http://tempcoverage.blob.core.windows.net/report4/System.Xml.XPath.XDocument.diff.html) ( csv )

고마워 에릭!

다음을 확인했습니다.

  • System.IO.Compression.Brotli
  • System.IO.Compression.Zip파일
  • 시스템.IO.파일시스템.드라이브 정보
  • System.IO.IsolatedStorage
  • System.IO.MemoryMappedFiles
  • 시스템.IO.파이프
  • 시스템.메모리

데드 코드 정리:
System.Diagnostics.DiagnosticSource
System.Diagnostics.FileVersionInfo
시스템.진단.프로세스
System.Diagnostics.StackTrace
System.Diagnostics.TextWriterTraceListener
시스템.진단.도구
System.Diagnostics.TraceSource
시스템.진단.추적
System.Drawing.Primitives

닷넷/corefx#33095

첫 번째 기여로 System.IO.Compression을 청소하고 싶습니다.

시작 게시물 System.Console 에서 완료로 표시되지만 재생성된 데이터 에서는 표시되지 않습니다. SR 의 문자열만 지워야 한다는 것을 알았습니다.
그래서 @ericstj , 일종의 실수입니까 아니면 다른 라이브러리를 살펴보고 작은 데드 코드를 수정할 수 있습니까?

요약

나는 이 데이터 에서 쓸모없는 것들을 제거하는 작은 도구 를 만들었습니다.


다음을 제거합니다.

  1. 빨간색으로 표시된 모든 const.

이것은 매우 일반적인 것입니다. "const"가 있는 것은 무시하십시오. 이것들은 모두 컴파일러에 의해 인라인된 필드이므로 소스에 유지하려고 합니다. 일반적으로 int 및 문자열입니다.

  1. 빨간색으로 표시되지 않은 모든 항목(해당 코드는 죽지 않음).

남아 있습니다:

  1. 데드 코드가 포함된 모든 중첩 수준 클래스 또는 구조체. 해당 코드를 더 빨리 찾는 데 도움이 됩니다.
  2. 제거할 수 있는 모든 SR 의 문자열입니다. 그러나 SR 의 메소드도 제거되지 않습니다.

"클래스 SR"에서 "정적 문자열"인 모든 것은 특별합니다. C# 파일을 편집하는 대신 .resx 파일에서 일치하는 항목을 찾아 제거해야 합니다. 라이브러리의 .resx 파일은 src에 있습니다.srcResourcesstrings.resx. 이 작업을 수행하면 빌드가 SR을 재생성합니다. "클래스 SR"의 다른 것은 무시하십시오. 죽은 것으로 나타날 수 있는 몇 가지 메서드가 있습니다.

  1. 매개변수가 없는 생성자가 하나만 있는 클래스. 그들과 함께 아무것도 하지 않는 것이 도움이 됩니다.

매개변수가 없는 개인 생성자를 무시하십시오. 실수로 클래스를 인스턴스화하는 것을 방지하기 위해 코드에 이러한 항목이 있으므로 코드에 유지하려고 합니다.

다른 생성자가 없는 경우 매개 변수가 없는 공용 생성자를 무시합니다. 이것들은 진짜가 아닙니다.


또한:

여기에서 지워진 파일을 찾을 수 있습니다. 데이터를 업데이트한 후 저를 언급해 주시면 업데이트하겠습니다.

@ericstj internal enum 를 제거하는 것이 안전합니까?

해당 도구 를 사용한 후 모든 어셈블리를 확인했습니다. 그들 중 일부는 데드 코드가 없습니다.
업데이트된 목록은 아래와 같습니다. 도구의 저장소 에서 지워진 파일에 대한 htmlpreview 링크를 변경합니다. 아무도 신경 쓰지 않기를 바랍니다.

그래서 @ericstj , 일종의 실수입니까 아니면 다른 라이브러리를 살펴보고 작은 데드 코드를 수정할 수 있습니까?

diff를 재생성할 때 모든 것이 다시 지워진 상태로 시작했습니다. dead-code-diffs를 수행하는 메커니즘은 너무 수동적입니다. 어셈블리 diff에 내부 도구를 사용하고 있습니다.

@ericstj 내부 열거형을 제거하는 것이 안전합니까?

해당 내부 열거형으로 수행되는 작업에 따라 다릅니다. 컴파일러가 소스 참조를 정수 리터럴로 변환하기 때문에 열거형은 바이너리에서 죽은 것으로 표시되는 경우가 많습니다. 소스에 여전히 필요할 수 있습니다.

이 데드 코드 스크러빙을 보다 안정적인 상태로 앞으로 나아가는 더 나은 경험으로 만들 수 있는 방법에 대한 몇 가지 생각입니다.

  1. 열기에 diffing 도구를 추가합니다. 내부 AsmDiff를 사용하고 있습니다. 이를 오픈 소스로 만들거나 기존 라이브러리(SRM, CCI 또는 Cecil) 위에 새로운 것을 만들 수 있습니다.
  2. 프로젝트가 이 노데드 코드 유효성 검사에 옵트인하도록 허용하고 도구에서 놓치는 것을 억제합니다.
  3. 휴리스틱을 서로 다른 규칙 및/또는 필터링 규칙에 넣어 2를 반복합니다.
  4. 도구에 충분한 기능이 있으면 전체 리포지토리에 대해 활성화하고 데드 코드를 허용하는 기준선을 커밋하고 이 문제로 다시 돌아올 필요가 없습니다 😄

오늘날 우리가 트리를 흔드는 데드 코드에 사용하는 메커니즘은 바이너리에서 작동하는 링커 입니다. 따라서 이를 다시 소스에 매핑하기 위해 출력과 입력을 비교하고 ID를 내보냅니다. 과거에 링커 사람들과 논의한 또 다른 사항은 개발자가 관심을 갖고 있는 항목에 더 직접 매핑할 수 있는 더 많은 로깅을 내보내는 것입니다. 또한 PDB에서 작동하므로 기술적으로 모든 소스 코드와 라인 정보가 있습니다.

@ericstj 는 기술적으로 corelib에서 실행할 수 있습니까? corelib에서 죽은 메서드를 발견했으며 의심할 여지 없이 더 많은 메서드가 있습니다. 확실히 VM의 모든 콜백을 고려할 때 주의가 필요합니다.

@danmosemsft 이미 Coreclr 빌드의 일부로 System.Private.Corelib.dll에서 실행 중입니다. 제거되지 않는 데드 메소드는 무엇입니까?

@ericstj 이걸 닫아도 될까요?

나는 이것이 지금은 끝났다고 생각한다. 더 나은 코드베이스를 만드는 데 기여한 모든 분들께 감사드립니다!

이 페이지가 도움이 되었나요?
0 / 5 - 0 등급

관련 문제

EgorBo picture EgorBo  ·  3코멘트

yahorsi picture yahorsi  ·  3코멘트

Timovzl picture Timovzl  ·  3코멘트

noahfalk picture noahfalk  ·  3코멘트

matty-hall picture matty-hall  ·  3코멘트