Skip to content

Running API diff without specifying -eattr makes it fail to load non-existent AttributesToExclude.txt file #49719

@ericstj

Description

@ericstj

When not specifying this parameter, it should either use some pre-defined internal attributes to exclude, or not exclude anything. Loading a non-existent file is busted.

apidiff -b "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\9.0.7\ref\net9.0" --beforeFriendlyName 9.0 -a "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\10.0.0-preview.4.25258.110\ref\net10.0" --afterFriendlyName 10.0 -o c:\scratch\10diff\
Selected options:
 - 'Before' source assemblies:         C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\9.0.7\ref\net9.0
 - 'After'  source assemblies:         C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\10.0.0-preview.4.25258.110\ref\net10.0
 - 'Before' reference assemblies:
 - 'After'  reference assemblies:
 - Output:                             c:\scratch\10diff\
 - Files with assemblies to exclude:
 - Files with attributes to exclude:   C:\Users\ericstj\AttributesToExclude.txt
 - Files with APIs to exclude:
 - 'Before' friendly name:             9.0
 - 'After' friendly name:              10.0
 - Table of contents title:            api_diff
 - Add partial modifier to types:      False
 - Attach debugger:                    False

Unhandled exception: System.IO.FileNotFoundException: Could not find file 'C:\Users\ericstj\AttributesToExclude.txt'.
File name: 'C:\Users\ericstj\AttributesToExclude.txt'
   at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
   at System.IO.File.ReadLines(String path)
   at Microsoft.DotNet.ApiDiff.FileOutputDiffGenerator.CollectListsFromFiles(FileInfo[] filesWithLists) in D:\a\_work\1\s\src\sdk\src\Compatibility\ApiDiff\Microsoft.DotNet.ApiDiff\FileOutputDiffGenerator.cs:line 183
   at Microsoft.DotNet.ApiDiff.FileOutputDiffGenerator..ctor(ILog log, String beforeAssembliesFolderPath, String beforeAssemblyReferencesFolderPath, String afterAssembliesFolderPath, String afterAssemblyReferencesFolderPath, String outputFolderPath, String beforeFriendlyName, String afterFriendlyName, String tableOfContentsTitle, FileInfo[] filesWithAssembliesToExclude, FileInfo[] filesWithAttributesToExclude, FileInfo[] filesWithApisToExclude, Boolean addPartialModifier, Boolean writeToDisk, IEnumerable`1 diagnosticOptions) in D:\a\_work\1\s\src\sdk\src\Compatibility\ApiDiff\Microsoft.DotNet.ApiDiff\FileOutputDiffGenerator.cs:line 78
   at Microsoft.DotNet.ApiDiff.DiffGeneratorFactory.Create(ILog log, String beforeAssembliesFolderPath, String beforeAssemblyReferencesFolderPath, String afterAssembliesFolderPath, String afterAssemblyReferencesFolderPath, String outputFolderPath, String beforeFriendlyName, String afterFriendlyName, String tableOfContentsTitle, FileInfo[] filesWithAssembliesToExclude, FileInfo[] filesWithAttributesToExclude, FileInfo[] filesWithApisToExclude, Boolean addPartialModifier, Boolean writeToDisk, IEnumerable`1 diagnosticOptions) in D:\a\_work\1\s\src\sdk\src\Compatibility\ApiDiff\Microsoft.DotNet.ApiDiff\DiffGeneratorFactory.cs:line 59
   at Microsoft.DotNet.ApiDiff.Tool.Program.HandleCommandAsync(DiffConfiguration diffConfig, CancellationToken cancellationToken) in D:\a\_work\1\s\src\sdk\src\Compatibility\ApiDiff\Microsoft.DotNet.ApiDiff.Tool\Program.cs:line 185
   at Microsoft.DotNet.ApiDiff.Tool.Program.<>c__DisplayClass1_0.<<Main>b__0>d.MoveNext() in D:\a\_work\1\s\src\sdk\src\Compatibility\ApiDiff\Microsoft.DotNet.ApiDiff.Tool\Program.cs:line 148
--- End of stack trace from previous location ---
   at System.CommandLine.Command.<>c__DisplayClass32_0.<<SetAction>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Invocation.InvocationPipeline.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)

Metadata

Metadata

Assignees

No one assigned

    Labels

    untriagedRequest triage from a team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions