In this thread, I was suggested to use Universal Packages as a way to publish internally to my team in Azure DevOps application.
I tried with a simple executable, but I’m getting a huge exception that makes little sense. I don’t understand.
I’m trying to determine if it is my mistake or a bug, but in any case, I’m very surprised by the unintelligible error.
This is my command:
az artifacts universal publish –organization https://dev.azure.com/Myorg –feed MyFeed –name MyPackageName –version 0.0.1 –path mytool.exe –description TestDescription –scope project –project ProjectName
Once I run my command, it says ‘- Publishing ..’ for a few seconds, and then this error:
Failed to hash a page of files. Exception listed below…
An exception was thrown: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.VisualStudio.Services.BlobStore.WebApi.DedupManifestArtifactClient.<>c__DisplayClass26_0.b__11(FileBlobDescriptor file)
at Microsoft.VisualStudio.Services.BlobStore.Common.PrecomputedHashesGenerator.<>c__DisplayClass31_0.<b__0>d.MoveNext()
— End of stack trace from previous location —
at Microsoft.VisualStudio.Services.Content.Common.NonSwallowingActionBlock.<>c__DisplayClass5_01.<<CreateNonSwallowingFunc>b__0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.VisualStudio.Services.BlobStore.Common.PrecomputedHashesGenerator.PaginateAndProcessFilesHelperAsync(String sourceDirectory, Boolean shouldPreserveSymbolicLink, Boolean shouldPreservePermissionValue, IEnumerable
1 pathsInDir, Action1 hashCompleteCallback, HashType hashType, CancellationToken cancellationToken) at Microsoft.VisualStudio.Services.BlobStore.Common.PrecomputedHashesGenerator.<>c__DisplayClass26_0.<<PaginateAndProcessFiles>b__0>d.MoveNext() Encountered an unexpected error. System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.VisualStudio.Services.BlobStore.WebApi.DedupManifestArtifactClient.<>c__DisplayClass26_0.<PublishAsync>b__11(FileBlobDescriptor file) at Microsoft.VisualStudio.Services.BlobStore.Common.PrecomputedHashesGenerator.<>c__DisplayClass31_0.<<PaginateAndProcessFilesHelperAsync>b__0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.VisualStudio.Services.Content.Common.NonSwallowingActionBlock.<>c__DisplayClass5_0
1.<b__0>d.MoveNext()
— End of stack trace from previous location —
at Microsoft.VisualStudio.Services.BlobStore.Common.PrecomputedHashesGenerator.PaginateAndProcessFilesHelperAsync(String sourceDirectory, Boolean shouldPreserveSymbolicLink, Boolean shouldPreservePermissionValue, IEnumerable1 pathsInDir, Action
1 hashCompleteCallback, HashType hashType, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.BlobStore.Common.PrecomputedHashesGenerator.<>c__DisplayClass26_0.<b__0>d.MoveNext()
— End of stack trace from previous location —
at Microsoft.VisualStudio.Services.Content.Common.ExceptionExtensions.ReThrow(Exception ex)
at Microsoft.VisualStudio.Services.BlobStore.Common.PrecomputedHashesGenerator.<>c__DisplayClass26_0.<b__0>d.MoveNext()
— End of stack trace from previous location —
at Microsoft.VisualStudio.Services.Content.Common.NonSwallowingActionBlock.<>c__DisplayClass5_01.<<CreateNonSwallowingFunc>b__0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.VisualStudio.Services.BlobStore.Common.PrecomputedHashesGenerator.PaginateAndProcessFiles(String sourceDirectory, HashType hashType, IEnumerable
1 pages, Boolean shouldPreserveSymbolicLink, Boolean shouldPreservePermissionValue, CancellationToken cancellationToken, Action1 hashCompleteCallback) at Microsoft.VisualStudio.Services.BlobStore.WebApi.DedupManifestArtifactClient.PublishAsync(String sourceDirectory, IReadOnlyCollection
1 fileInfoList, IReadOnlyDictionary2 otherFiles, ArtifactPublishOptions artifactPublishOptions, String manifestFileOutputPath, CancellationToken cancellationToken) at Microsoft.VisualStudio.Services.Packaging.UPackClientShared.UPackSharedClient.PushWithoutCheckingForDuplicatePackageAsync(String projectNameOrId, String feedNameOrId, String packageName, String packageVersion, String description, String sourceDirectory, Boolean honorIgnoreOptions, CancellationToken cancellationToken) at Microsoft.VisualStudio.Services.Packaging.UPackClientShared.UPackSharedClient.PushAsync(String projectNameOrId, String feedNameOrId, String packageName, String packageVersion, String description, String sourceDirectory, Boolean honorIgnoreOptions, CancellationToken cancellationToken) at ArtifactTool.Commands.UPackPublishCommand.<>c__DisplayClass25_0.<<ExecuteAsync>b__0>d.MoveNext() in D:a1ssrcArtifactToolCommandsUPackUPackPublishCommand.cs:line 59 --- End of stack trace from previous location --- at ArtifactTool.Commands.UPack.UPackExceptionMapper.WithExceptionHandlingAsync(Func
1 act) in D:a1ssrcArtifactToolCommandsUPackUPackExceptionMapper.cs:line 39
at ArtifactTool.Commands.UPackPublishCommand.ExecuteAsync() in D:a1ssrcArtifactToolCommandsUPackUPackPublishCommand.cs:line 57
at ArtifactTool.Commands.CommandBase.OnExecuteAsync() in D:a1ssrcArtifactToolCommandsCommandBase.cs:line 105
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.InvokeAsync(MethodInfo method, Object instance, Object[] arguments) in C:projectscommandlineutilssrcCommandLineUtilsConventionsExecuteMethodConvention.cs:line 77
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context) in C:projectscommandlineutilssrcCommandLineUtilsConventionsExecuteMethodConvention.cs:line 62
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<b__0>d.MoveNext() in C:projectscommandlineutilssrcCommandLineUtilsConventionsExecuteMethodConvention.cs:line 25
— End of stack trace from previous location —
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass126_0.b__0() in C:projectscommandlineutilssrcCommandLineUtilsCommandLineApplication.cs:line 505
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) in C:projectscommandlineutilssrcCommandLineUtilsCommandLineApplication.cs:line 611
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](CommandLineContext context) in C:projectscommandlineutilssrcCommandLineUtilsCommandLineApplication.Execute.cs:line 57
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync[TApp](CommandLineContext context) in C:projectscommandlineutilssrcCommandLineUtilsCommandLineApplication.Execute.cs:line 145
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync[TApp](IConsole console, String[] args) in C:projectscommandlineutilssrcCommandLineUtilsCommandLineApplication.Execute.cs:line 130
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync[TApp](String[] args) in C:projectscommandlineutilssrcCommandLineUtilsCommandLineApplication.Execute.cs:line 112
Process [‘C:UsersRobertoBasile.azureazuredevopsclitoolsartifacttoolArtifactTool_win10-x64_0.2.308artifacttool’, ‘universal’, ‘publish’, ‘–service’, ‘https://dev.azure.com/MyOrg’, ‘–patvar’, ‘AZURE_DEVOPS_EXT_ARTIFACTTOOL_PATVAR’, ‘–feed’, ‘MyFeed’, ‘–package-name’, ‘mytool’, ‘–package-version’, ‘0.0.1’, ‘–path’, ‘mytool.exe’, ‘–project’, ‘ProjectName’, ‘–description’, ‘TestDescription’] with PID 40472 exited with return code 1
What do you think is going on?
Thanks
2
Answers
I found a workaround (not really a solution, but it can unstuck who has the same problem why we try to find a way). Instead of
mytool.exe
, I useC:fullpathmytool.exe
, which works.It doesn't make a lot of sense, but it works. Hope it can help someone
The above error indicates a problem while the hashing process of your file
mytool.exe
is happening before uploading the package to Azure Artifacts.Check the package (.NET) version because if it is outdated then also this conflict arises.
Check Az CLI and artifact tool version and update if required.
az upgrade
Verify the file path you are providing is accurately given.
Note: Update the devops extension with CLI command
az extension update --name azure-devops
if needed for your environment to avoid conflicts.After checking all the above, I tried to execute the same command as you to publish the artifacts and was able to perform it successfully.
Reference: MSDoc