Runtime: Lots of duplicate *.cs files in corefx

Created on 8 Mar 2018  路  34Comments  路  Source: dotnet/runtime

I wrote a small script to detect duplicates and it turns out there lots of such files in the repository
When I try to re-use some of the following files in mono I am confused which one to pick
Also the script detects files with a very small diff (see second group)
Is it intentional?

ExternDll.cs:
   src\System.DirectoryServices\src\System\DirectoryServices\ExternDll.cs
   src\System.DirectoryServices.AccountManagement\src\System\DirectoryServices\AccountManagement\ExternDll.cs

Interop.IOErrors.cs:
   src\Common\src\CoreLib\Interop\Unix\Interop.IOErrors.cs
   src\Common\src\Interop\Unix\Interop.IOErrors.cs

Interop.Close.cs:
   src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.Close.cs
   src\Common\src\Interop\Unix\System.Native\Interop.Close.cs

Interop.FLock.cs:
   src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.FLock.cs
   src\Common\src\Interop\Unix\System.Native\Interop.FLock.cs

Interop.FSync.cs:
   src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.FSync.cs
   src\Common\src\Interop\Unix\System.Native\Interop.FSync.cs

Interop.FTruncate.cs:
   src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.FTruncate.cs
   src\Common\src\Interop\Unix\System.Native\Interop.FTruncate.cs

Interop.GetCwd.cs:
   src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.GetCwd.cs
   src\Common\src\Interop\Unix\System.Native\Interop.GetCwd.cs

Interop.LSeek.cs:
   src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.LSeek.cs
   src\Common\src\Interop\Unix\System.Native\Interop.LSeek.cs

Interop.MksTemps.cs:
   src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.MksTemps.cs
   src\Common\src\Interop\Unix\System.Native\Interop.MksTemps.cs

Interop.Open.cs:
   src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.Open.cs
   src\Common\src\Interop\Unix\System.Native\Interop.Open.cs

Interop.OpenFlags.cs:
   src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.OpenFlags.cs
   src\Common\src\Interop\Unix\System.Native\Interop.OpenFlags.cs

Interop.PathConf.cs:
   src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.PathConf.cs
   src\Common\src\Interop\Unix\System.Native\Interop.PathConf.cs

Interop.Permissions.cs:
   src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.Permissions.cs
   src\Common\src\Interop\Unix\System.Native\Interop.Permissions.cs

Interop.PosixFAdvise.cs:
   src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.PosixFAdvise.cs
   src\Common\src\Interop\Unix\System.Native\Interop.PosixFAdvise.cs

Interop.ReadLink.cs:
   src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.ReadLink.cs
   src\Common\src\Interop\Unix\System.Native\Interop.ReadLink.cs

Interop.Stat.cs:
   src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.Stat.cs
   src\Common\src\Interop\Unix\System.Native\Interop.Stat.cs

Interop.SysLog.cs:
   src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.SysLog.cs
   src\Common\src\Interop\Unix\System.Native\Interop.SysLog.cs

Interop.Unlink.cs:
   src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.Unlink.cs
   src\Common\src\Interop\Unix\System.Native\Interop.Unlink.cs

Interop.BOOL.cs:
   src\Common\src\CoreLib\Interop\Windows\Interop.BOOL.cs
   src\Common\src\Interop\Windows\Interop.BOOL.cs

Interop.CancelIoEx.cs:
   src\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.CancelIoEx.cs
   src\Common\src\Interop\Windows\kernel32\Interop.CancelIoEx.cs

Interop.CloseHandle.cs:
   src\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.CloseHandle.cs
   src\Common\src\Interop\Windows\kernel32\Interop.CloseHandle.cs

Interop.FileAttributes.cs:
   src\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.FileAttributes.cs
   src\Common\src\Interop\Windows\kernel32\Interop.FileAttributes.cs

Interop.FindClose.cs:
   src\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.FindClose.cs
   src\Common\src\Interop\Windows\kernel32\Interop.FindClose.cs

Interop.FlushFileBuffers.cs:
   src\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.FlushFileBuffers.cs
   src\Common\src\Interop\Windows\kernel32\Interop.FlushFileBuffers.cs

Interop.ReadFile_SafeHandle_IntPtr.cs:
   src\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.ReadFile_SafeHandle_IntPtr.cs
   src\Common\src\Interop\Windows\kernel32\Interop.ReadFile_SafeHandle_IntPtr.cs

Interop.ReadFile_SafeHandle_NativeOverlapped.cs:
   src\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.ReadFile_SafeHandle_NativeOverlapped.cs
   src\Common\src\Interop\Windows\kernel32\Interop.ReadFile_SafeHandle_NativeOverlapped.cs

Interop.SecurityOptions.cs:
   src\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.SecurityOptions.cs
   src\Common\src\Interop\Windows\kernel32\Interop.SecurityOptions.cs

Interop.SetEndOfFile.cs:
   src\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.SetEndOfFile.cs
   src\Common\src\Interop\Windows\kernel32\Interop.SetEndOfFile.cs

Interop.SetFilePointerEx.cs:
   src\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.SetFilePointerEx.cs
   src\Common\src\Interop\Windows\kernel32\Interop.SetFilePointerEx.cs

Interop.WriteFile_SafeHandle_IntPtr.cs:
   src\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.WriteFile_SafeHandle_IntPtr.cs
   src\Common\src\Interop\Windows\kernel32\Interop.WriteFile_SafeHandle_IntPtr.cs

Interop.WriteFile_SafeHandle_NativeOverlapped.cs:
   src\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.WriteFile_SafeHandle_NativeOverlapped.cs
   src\Common\src\Interop\Windows\kernel32\Interop.WriteFile_SafeHandle_NativeOverlapped.cs

SafeDirectoryHandle.Unix.cs:
   src\Common\src\CoreLib\Microsoft\Win32\SafeHandles\SafeDirectoryHandle.Unix.cs
   src\Common\src\Microsoft\Win32\SafeHandles\SafeDirectoryHandle.Unix.cs

ICollectionDebugView.cs:
   src\Common\src\CoreLib\System\Collections\Generic\ICollectionDebugView.cs
   src\System.Collections\src\System\Collections\Generic\ICollectionDebugView.cs

IDictionaryDebugView.cs:
   src\Common\src\CoreLib\System\Collections\Generic\IDictionaryDebugView.cs
   src\System.Collections\src\System\Collections\Generic\IDictionaryDebugView.cs

DisableMediaInsertionPrompt.cs:
   src\Common\src\CoreLib\System\IO\DisableMediaInsertionPrompt.cs
   src\System.IO.FileSystem\src\System\IO\DisableMediaInsertionPrompt.cs

StreamHelpers.CopyValidation.cs:
   src\Common\src\CoreLib\System\IO\StreamHelpers.CopyValidation.cs
   src\Common\src\System\IO\StreamHelpers.CopyValidation.cs

DeferredDisposableLifetime.cs:
   src\Common\src\CoreLib\System\Threading\DeferredDisposableLifetime.cs
   src\System.Threading.Overlapped\src\System\Threading\DeferredDisposableLifetime.cs

TaskToApm.cs:
   src\Common\src\CoreLib\System\Threading\Tasks\TaskToApm.cs
   src\Common\src\System\Threading\Tasks\TaskToApm.cs

NetEventSource.Security.Windows.cs:
   src\Common\src\System\Net\Security\NetEventSource.Security.Windows.cs
   src\System.Net.Security\src\System\Net\Security\NetEventSource.Security.Windows.cs

DisableParallelization.cs:
   src\Common\tests\System\Xml\DisableParallelization.cs
   src\System.Private.Xml\tests\Writers\XmlWriterApi\DisableParallelization.cs

AppContext.Switch.cs:
   src\System.AppContext\tests\AppContext.Switch.cs
   src\System.Runtime\tests\System\AppContext\AppContext.Switch.cs

AppContext.Switch.Validation.cs:
   src\System.AppContext\tests\AppContext.Switch.Validation.cs
   src\System.Runtime\tests\System\AppContext\AppContext.Switch.Validation.cs

KeyValuePairs.cs:
   src\System.Collections.NonGeneric\src\System\Collections\KeyValuePairs.cs
   src\System.Runtime.Extensions\src\System\Collections\KeyValuePairs.cs

TimeoutTimer.cs:
   src\System.Data.Odbc\src\Common\System\Data\ProviderBase\TimeoutTimer.cs
   src\System.Data.SqlClient\src\System\Data\ProviderBase\TimeoutTimer.cs

FakeContextAwareResult.cs:
   src\System.Net.NameResolution\tests\PalTests\Fakes\FakeContextAwareResult.cs
   src\System.Net.NameResolution\tests\UnitTests\Fakes\FakeContextAwareResult.cs

CollectionDataContractAttribute.cs:
   src\System.Private.DataContractSerialization\src\System\Runtime\Serialization\CollectionDataContractAttribute.cs
   src\System.Runtime.Serialization.Primitives\src\System\Runtime\Serialization\CollectionDataContractAttribute.cs

ContractNamespaceAttribute.cs:
   src\System.Private.DataContractSerialization\src\System\Runtime\Serialization\ContractNamespaceAttribute.cs
   src\System.Runtime.Serialization.Primitives\src\System\Runtime\Serialization\ContractNamespaceAttribute.cs

DataContractAttribute.cs:
   src\System.Private.DataContractSerialization\src\System\Runtime\Serialization\DataContractAttribute.cs
   src\System.Runtime.Serialization.Primitives\src\System\Runtime\Serialization\DataContractAttribute.cs

EnumMemberAttribute.cs:
   src\System.Private.DataContractSerialization\src\System\Runtime\Serialization\EnumMemberAttribute.cs
   src\System.Runtime.Serialization.Primitives\src\System\Runtime\Serialization\EnumMemberAttribute.cs

AssemblyAttributes.cs:
   src\Common\tests\System\Diagnostics\RemoteExecutorConsoleApp\AssemblyAttributes.cs
   src\System.Runtime\tests\TestAssembly\AssemblyAttributes.cs
   src\System.Runtime.Extensions\tests\AssemblyResolveTests\AssemblyAttributes.cs
   src\System.Runtime.Extensions\tests\TestApp\AssemblyAttributes.cs
   src\System.Runtime.Extensions\tests\TestAppOutsideOfTPA\AssemblyAttributes.cs
   src\System.Runtime.Extensions\tests\VoidMainWithExitCodeApp\AssemblyAttributes.cs

GlobalSuppressions.cs:
   src\System.Collections.Immutable\src\GlobalSuppressions.cs
   src\System.Text.Encodings.Web\src\Properties\GlobalSuppressions.cs

XunitTestAssemblyAtrributes.cs:
   src\System.Net.Http.WinHttpHandler\tests\FunctionalTests\XunitTestAssemblyAtrributes.cs
   src\System.Net.Http.WinHttpHandler\tests\UnitTests\XunitTestAssemblyAtrributes.cs

Serialization.cs:
   src\System.Net.Primitives\tests\PalTests\Fakes\Serialization.cs
   src\System.Net.Primitives\tests\UnitTests\Fakes\Serialization.cs

The following files have a very small diff:

Interop.Errors.cs:
   src\Common\src\CoreLib\Interop\Unix\Interop.Errors.cs
   src\Common\src\Interop\Unix\Interop.Errors.cs

IPv4AddressHelper.cs:
   src\System.Net.Primitives\src\System\Net\IPv4AddressHelper.cs
   src\System.Private.Uri\src\System\IPv4AddressHelper.cs

Interop.FormatMessage.cs:
   src\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.FormatMessage.cs
   src\Common\src\Interop\Windows\kernel32\Interop.FormatMessage.cs

TupleExtensions.cs:
   src\Common\src\CoreLib\System\TupleExtensions.cs
   src\System.ValueTuple\src\System\ValueTuple\TupleExtensions.cs

DriveNotFoundException.cs:
   src\Common\src\CoreLib\System\IO\DriveNotFoundException.cs
   src\System.IO.FileSystem.DriveInfo\src\System\IO\DriveNotFoundException.cs

XmlRawWriter.cs:
   src\Common\src\System\Xml\XmlRawWriter.cs
   src\System.Private.Xml\src\System\Xml\Core\XmlRawWriter.cs

IProducerConsumerCollection.cs:
   src\System.Collections.Concurrent\src\System\Collections\Concurrent\IProducerConsumerCollection.cs
   src\System.Threading.Tasks.Dataflow\src\Internal\IProducerConsumerCollection.cs

InvalidEnumArgumentException.cs:
   src\System.ComponentModel.Primitives\src\System\ComponentModel\InvalidEnumArgumentException.cs
   src\System.Drawing.Common\src\misc\InvalidEnumArgumentException.cs

DbConnectionClosed.cs:
   src\System.Data.Odbc\src\Common\System\Data\ProviderBase\DbConnectionClosed.cs
   src\System.Data.SqlClient\src\System\Data\ProviderBase\DbConnectionClosed.cs

DbConnectionFactory.cs:
   src\System.Data.Odbc\src\Common\System\Data\ProviderBase\DbConnectionFactory.cs
   src\System.Data.SqlClient\src\System\Data\ProviderBase\DbConnectionFactory.cs

DbConnectionPoolGroup.cs:
   src\System.Data.Odbc\src\Common\System\Data\ProviderBase\DbConnectionPoolGroup.cs
   src\System.Data.SqlClient\src\System\Data\ProviderBase\DbConnectionPoolGroup.cs

DbMetaDataFactory.cs:
   src\System.Data.Odbc\src\Common\System\Data\ProviderBase\DbMetaDataFactory.cs
   src\System.Data.SqlClient\src\System\Data\ProviderBase\DbMetaDataFactory.cs

DbReferenceCollection.cs:
   src\System.Data.Odbc\src\Common\System\Data\ProviderBase\DbReferenceCollection.cs
   src\System.Data.SqlClient\src\System\Data\ProviderBase\DbReferenceCollection.cs

DataMemberAttribute.cs:
   src\System.Private.DataContractSerialization\src\System\Runtime\Serialization\DataMemberAttribute.cs
   src\System.Runtime.Serialization.Primitives\src\System\Runtime\Serialization\DataMemberAttribute.cs

EDIT by @krwq:
Similar issue but needs investigation on exact file list:

area-Meta enhancement up-for-grabs

Most helpful comment

@danmosemsft @MarcoRossignoli
Here is the script: https://gist.github.com/EgorBo/bc20111c9f7514f6ba584e1d91da60a6
it looks messy and I used a diff tool provided by git 馃檪

All 34 comments

The majority of the dups are because files were copied into the corelib repo (or vice versa), but since then we started mirroring a large portion of corelib into corefx, and we haven't done the general work to change corefx projects to use the mirrored files... but that's the direction we're heading.
cc: @jkotas

I think the src\Common\src\CoreLib copies makes sense and we see it as sort of work in progress in CoreFX but there are others which are not in CoreLib for example KeyValuePairs.cs or DbConnectionClosed.cs and they are more confusing.

but there are others

Those typically came about because the file was imported as part of a library that needed it, and it wasn't deduped against the rest of the repo and put into Common.

@EgorBo can you attach the script?Maybe i could try to work on this, if i understand well we need to remove and link common file to projects and verify if all it's ok, right?
@stephentoub today the sync in only coreclr -> corefx right?

@MarcoRossignoli yes the sync is only coreclr to corefx. It would be great if you could look at deduping yes.

@egorbo do you still have the script handy?

BTW that many of these files are not quite duplicates (eg formatting changed or one is alive and had a few fixes in it) so I suggest start by finding duplicate names then either eyeball the diff or look for "small" diff outputs rather than simply running one of the many scripts that find exact duplicate files.

@danmosemsft sure the scripts is only to save time, but i agree with you, we should to check every file. Could be not so easy understand the correct one, and maybe to avoid conflicts could be useful do more PR. I wait for @EgorBo and after i'll try to work on this if you agree.

That would be great!

@danmosemsft @MarcoRossignoli
Here is the script: https://gist.github.com/EgorBo/bc20111c9f7514f6ba584e1d91da60a6
it looks messy and I used a diff tool provided by git 馃檪

@EgorBo great! TYVM

@danmosemsft i'm working on this, my idea is for first fix 100% identical files, and after check < 30%(take me more time, to avoid conflict i'll do more PRs).

OK we are stabilizing to ship over coming weeks so I suggest first a safe PR for identical and dead files. Then the rest maybe we hold the PR for after we branch for the last time

@danmosemsft @stephentoub i run tools with < 30% diff...now for instance difference between src\Common\src\CoreLib\Interop\Unix\Interop.Errors.cs and src\Common\src\Interop\Unix\Interop.Errors.cs is a pair of enum value missing from CoreLib file.

Tools.DiffFiles ...\corefx\src\Common\src\CoreLib\Interop\Unix\Interop.Errors.cs ...\corefx\src\Common\src\Interop\Unix\Interop.Errors.cs

To update those difference my idea is to PR on coreclr the difference, wait merge and after that replace proj ref. Is this a correct way?Do you have better idea?

@MarcoRossignoli yes, that's what you will have to do for any changes where the corelib version is "better".

@MarcoRossignoli yes, that's what you will have to do for any changes where the corelib version is "better".

corelib you mean corefx?

@MarcoRossignoli oops, yes.

@ViktorHofer i saw you move hashtable to shared one week ago. On core fx there are another "version" with some difference...is correct override corefx version to coreclr?

Tools.DiffFiles
corefxsrc\Common\src\CoreLib\System\Collections\Hashtable.cs corefx\src\System.Runtime.Extensions\src\System\Collections\Hashtable.cs

@jkotas i know you don't like too much unmanaged signature changes...related to this issue...do you think i should skip this?

Tools.DiffFiles
corefxsrc\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.GetFullPathNameW.cs corefx\src\Common\src\Interop\Windows\kernel32\Interop.GetFullPathNameW.cs

We had some issues with the changes and during that I probably forgot to delete the old one. This one should be deleted: corefx\src\System.Runtime.Extensions\src\System\Collections\Hashtable.cs

corefx\src\Common\src\Interop\Windows\kernel32\Interop.GetFullPathNameW.cs

I do not see this one used anywhere. Delete it?

corefx\src\Common\src\Interop\Windows\kernel32\Interop.GetFullPathNameW.cs

I do not see this one used anywhere. Delete it?

no ref on coreclr

...coreclr>findstr /n /s /c:"Interop.GetFullPathNameW.cs" *.csproj

but ref on corefx

src\Common\tests\Common.Tests.csproj:111:    <Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.GetFullPathNameW.cs">
src\Common\tests\Common.Tests.csproj:112:      <Link>Common\Interop\Windows\kernel32\Interop.GetFullPathNameW.cs</Link>
src\System.Runtime.Extensions\src\System.Runtime.Extensions.csproj:202:    <Compile Include="$(CommonPath)\CoreLib\Interop\Windows\Kernel32\Interop.GetFullPathNameW.cs">
src\System.Runtime.Extensions\src\System.Runtime.Extensions.csproj:203:      <Link>CoreLib\Interop\Windows\Kernel32\Interop.GetFullPathNameW.cs</Link>

src\System.Runtime.Extensions\src\System.Runtime.Extensions.csproj:202: <Compile Include="$(CommonPath)\CoreLib\Interop\Windows\Kernel32\Interop.GetFullPathNameW.cs">

This is the copy from CoreLib already. Do you see the other (non-CoreLib) copy used anywhere?

This is the copy from CoreLib already. Do you see the other (non-CoreLib) copy used anywhere?

src\Common\tests\Common.Tests.csproj:111:    <Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.GetFullPathNameW.cs">
src\Common\tests\Common.Tests.csproj:112:      <Link>Common\Interop\Windows\kernel32\Interop.GetFullPathNameW.cs</Link>

https://github.com/dotnet/corefx/blob/master/src/Common/tests/Common.Tests.csproj#L111

actually i think that api is not used:

findstr /n /s /c:"GetFullPathNameW" *.cs

src\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.GetFullPathNameW.cs:16:        internal static extern uint GetFullPathNameW(ref char lpFileName, uint nBufferLength, ref char lpBuffer, IntPtr lpFilePart);
src\Common\src\CoreLib\System\IO\PathHelper.Windows.cs:79:            while ((result = Interop.Kernel32.GetFullPathNameW(ref MemoryMarshal.GetReference(path), (uint)builder.Capacity, ref builder.GetPinnableReference(), IntPtr.Zero)) > builder.Capacity)
src\Common\src\Interop\Windows\kernel32\Interop.GetFullPathNameW.cs:16:        internal static extern unsafe uint GetFullPathNameW(char* path, uint numBufferChars, SafeHandle buffer, IntPtr mustBeZero);

@jkotas i think i can remove file...do you agree?

@jkotas i think i can remove file...do you agree?

Yes

@EgorBo, can you re-run your script? I'm wondering what's still left to do here or if this issue can be closed.

@stephentoub actually there could be other duplicates...great part has been removed, but there are other files to check one by one with diff tool, some of these are false positive(es. small file with small difference distort the percentage). I'm working on other PR right now, if you can wait i'll try to complete this issue...will take me sometime i think.
If you think that the work done is enough feel free to close.

One question, could make sense write a script(es powershell) to use periodically? Or you are quite sure that this won't happen in future anymore(because now everybody check before on mirror)?

  • [X] IProducerConsumerCollection.cs:

    • corefxsrc\Common\src\CoreLib\System\Collections\Concurrent\IProducerConsumerCollection.cs
    • corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\IProducerConsumerCollection.cs
    • corefx\src\System.Threading.Tasks.Dataflow\src\Internal\IProducerConsumerCollection.cs
  • [X] ConcurrentQueue_Segment.cs:

    • corefxsrc\Common\src\CoreLib\System\Collections\Concurrent\ConcurrentQueue_Segment.cs
    • corefx\src\Common\src\System\Collections\Concurrent\ConcurrentQueue_Segment.cs
  • [X] SafeFileHandle.Unix.cs:

    • corefxsrc\Common\src\CoreLib\Microsoft\Win32\SafeHandles\SafeFileHandle.Unix.cs
    • corefx\src\Common\src\Microsoft\Win32\SafeHandles\SafeFileHandle.Unix.cs
  • [X] IList.cs:

    • corefxsrc\Common\src\CoreLib\System\Collections\IList.cs
    • corefxsrc\Common\src\CoreLib\System\Collections\Generic\IList.cs
  • [X] ConcurrentQueue.cs:

    • corefxsrc\Common\src\CoreLib\System\Collections\Concurrent\ConcurrentQueue.cs
    • corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\ConcurrentQueue.cs
  • [X] Interop.GetFileInformationByHandleEx.cs:

    • corefxsrc\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.GetFileInformationByHandleEx.cs
    • corefx\src\Common\src\Interop\Windows\kernel32\Interop.GetFileInformationByHandleEx.cs
  • [X] Interop.GetFileType_SafeHandle.cs:

    • corefxsrc\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.GetFileType_SafeHandle.cs
    • corefx\src\Common\src\Interop\Windows\kernel32\Interop.GetFileType_SafeHandle.cs
  • [X] Interop.LoadLibraryEx.cs:

    • corefxsrc\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.LoadLibraryEx.cs
    • corefx\src\Common\src\Interop\Windows\kernel32\Interop.LoadLibraryEx.cs
  • [X] Interop.SendMessageTimeout.cs:

    • corefxsrc\Common\src\CoreLib\Interop\Windows\User32\Interop.SendMessageTimeout.cs
    • corefx\src\Common\src\Interop\Windows\user32\Interop.SendMessageTimeout.cs
  • [X] IComparer.cs:

    • corefxsrc\Common\src\CoreLib\System\Collections\IComparer.cs
    • corefxsrc\Common\src\CoreLib\System\Collections\Generic\IComparer.cs
  • [X] IDictionary.cs:

    • corefxsrc\Common\src\CoreLib\System\Collections\IDictionary.cs
    • corefxsrc\Common\src\CoreLib\System\Collections\Generic\IDictionary.cs
  • [X] IEnumerator.cs:

    • corefxsrc\Common\src\CoreLib\System\Collections\IEnumerator.cs
    • corefxsrc\Common\src\CoreLib\System\Collections\Generic\IEnumerator.cs
  • [X] Interop.BCryptGenRandom.cs:

    • corefxsrc\Common\src\CoreLib\Interop\Windows\BCrypt\Interop.BCryptGenRandom.cs
    • corefx\src\Common\src\Interop\Windows\BCrypt\Interop.BCryptGenRandom.cs
  • [X] TupleExtensions.cs:

    • corefxsrc\Common\src\CoreLib\System\TupleExtensions.cs
    • corefx\src\System.ValueTuple\src\System\ValueTuple\TupleExtensions.cs
  • [X] ValueTuple.cs:

    • corefxsrc\Common\src\CoreLib\System\ValueTuple.cs
    • corefx\src\System.ValueTuple\src\System\ValueTuple\ValueTuple.cs
  • [X] ArrayPool.cs:

    • corefxsrc\Common\src\CoreLib\System\Buffers\ArrayPool.cs
    • corefx\src\System.Buffers\src\System\Buffers\ArrayPool.cs
  • [X] NonVersionableAttribute.cs:

    • corefxsrc\Common\src\CoreLib\System\Runtime\VersioningNonVersionableAttribute.cs
    • corefx\src\Common\src\System\Runtime\VersioningNonVersionableAttribute.cs
  • [X] Interop.CREATEFILE2_EXTENDED_PARAMETERS.cs:

    • corefxsrc\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.CREATEFILE2_EXTENDED_PARAMETERS.cs
    • corefx\src\Common\src\Interop\Windows\kernel32\Interop.CREATEFILE2_EXTENDED_PARAMETERS.cs
  • [X] SerializableAttribute.cs:

    • corefxsrc\Common\src\CoreLib\System\SerializableAttribute.cs
    • corefx\src\Common\src\System\SerializableAttribute.cs
  • [X] PathInternal.Unix.cs:

    • corefxsrc\Common\src\CoreLib\System\IO\PathInternal.Unix.cs
    • corefx\src\Common\src\System\IO\PathInternal.Unix.cs
  • [X] PathInternal.Windows.cs:

    • corefxsrc\Common\src\CoreLib\System\IO\PathInternal.Windows.cs
    • corefx\src\Common\src\System\IO\PathInternal.Windows.cs
  • [X] Error.cs:

    • corefxsrc\Common\src\CoreLib\System\IO\Error.cs
    • corefx\src\System.Console\src\System\IO\Error.cs
    • corefx\src\System.IO.FileSystem\src\System\IO\Error.cs
    • corefx\src\System.IO.Pipes\src\System\IO\Error.cs
  • [X] Interop.Libraries.cs:

    • corefxsrc\Common\src\CoreLib\Interop\Unix\Interop.Libraries.cs
    • corefxsrc\Common\src\CoreLib\Interop\Windows\Interop.Libraries.cs
    • corefx\src\Common\src\Interop\Linux\Interop.Libraries.cs
    • corefx\src\Common\src\Interop\Unix\Interop.Libraries.cs
  • [X] SafeLibraryHandle.cs:

    • corefxsrc\Common\src\CoreLib\Microsoft\Win32\SafeHandles\SafeLibraryHandle.cs
    • corefx\src\Common\src\Microsoft\Win32\SafeHandles\SafeLibraryHandle.cs
  • [X] Marvin.cs:

    • corefxsrc\Common\src\CoreLib\System\Marvin.cs
    • corefx\src\Common\src\System\Marvin.cs
  • [X] Interop.FindClose.cs:

    • corefxsrc\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.FindClose.cs
    • corefx\src\Common\src\Interop\Windows\kernel32\Interop.FindClose.cs
  • [X] Interop.FindFirstFileEx.cs:

    • corefxsrc\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.FindFirstFileEx.cs
    • corefx\src\Common\src\Interop\Windows\kernel32\Interop.FindFirstFileEx.cs
  • [X] Interop.FreeLibrary.cs:

    • corefxsrc\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.FreeLibrary.cs
    • corefx\src\Common\src\Interop\Windows\kernel32\Interop.FreeLibrary.cs
  • [X] Interop.GetFileAttributesEx.cs:

    • corefxsrc\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.GetFileAttributesEx.cs
    • corefx\src\Common\src\Interop\Windows\kernel32\Interop.GetFileAttributesEx.cs
  • [X] DecoderBestFitFallback.cs:

    • corefxsrc\Common\src\CoreLib\System\Text\DecoderBestFitFallback.cs
    • corefx\src\System.Text.Encoding.CodePages\src\System\Text\DecoderBestFitFallback.cs
  • [X] EncoderBestFitFallback.cs:

    • corefxsrc\Common\src\CoreLib\System\Text\EncoderBestFitFallback.cs
    • corefx\src\System.Text.Encoding.CodePages\src\System\Text\EncoderBestFitFallback.cs

@MarcoRossignoli if you can make this into a checklist (maybe edit top post or create new issue for clarity) I bet other folks will help especially some new to the repo.

Yes I think a script akin to your FindResourceDuplicates.ps1 would be useful.

@danmosemsft ok, i wait to know if @EgorBo update this issue with new checklist list and script proposal(i cannot change this post, right?) or let me know if you want a new issue.

Oh yes it's not your issue. @EgorBo mind if we close this and @MarcoRossignoli starts a fresh one with the remainder?

@JeremyKuhne related to this issue...file Interop.FindFirstFileEx.cs in

src/Common/src/CoreLib/Interop/Windows/Kernel32/Interop.FindFirstFileEx.cs
src/Common/src/Interop/Windows/kernel32/Interop.FindFirstFileEx.cs

there are some differences...can we use only one of two(or do nothing)?

@jkotas i found src\Common\src\CoreLib\System\IO\Error.cs

src\System.Console\src\System\IO\Error.cs
src\System.IO.FileSystem\src\System\IO\Error.cs
src\System.IO.Pipes\src\System\IO\Error.cs

but i don't think is a good idea move to corelibs all helpers...do you agree?

src\Common\src\CoreLib\System\IO\Error.cs
but i don't think is a good idea move to corelibs all helpers...do you agree?

Agree. If we wanted to do something about these, I think we should move them into the classes that use them.

Interop.FindFirstFileEx.cs

These should be pretty straightforward to unify:

  • BestFitMapping = false in CoreFX version is unnecessary
  • EnsureExtendedPrefixOverMaxPath in CoreCLR version should be replaced by EnsureExtendedPrefixIfNeeded
  • FINDEX_INFO_LEVELS and FINDEX_SEARCH_OPS are separate files in corefx. They can be in the same file with FindFirstFileEx since they are only ever used with this API.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

iCodeWebApps picture iCodeWebApps  路  3Comments

btecu picture btecu  路  3Comments

matty-hall picture matty-hall  路  3Comments

omariom picture omariom  路  3Comments

noahfalk picture noahfalk  路  3Comments