Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Xamarin.Android.Build.Tasks] NullReferenceException in Xamarin.Android.Common.targets #6126

Merged
merged 2 commits into from Jul 29, 2021

Conversation

dellis1972
Copy link
Contributor

Fixes #6124

Commit 2a04748 removed the [Required] attribute from the KeyPass
and StorePass properties. This was because they were now optional.
However keytool does REQUIRE these parameters when we use the -ks
or KeyStore argument.

If a user does not pass these arguments they get the following error

    error XAAAS7001: System.NullReferenceException: Object reference not set to an instance of an object.
    error XAAAS7001: at Xamarin.Android.Tasks.AndroidApkSigner.AddStorePass(CommandLineBuilder cmd, String cmdLineSwitch, String value)
    error XAAAS7001: at Xamarin.Android.Tasks.AndroidApkSigner.GenerateCommandLineCommands()

This is because the KeyPass or StorePass are null and the AddStorePass
function is not handling that.

So what we should do is when the KeyStore argument is being used we should
error out if KeyPass or StorePass are empty or null.

…id.Common.targets

Fixes xamarin#6124

Commit 2a04748 removed the `[Required]` attribute from the `KeyPass`
and `StorePass` properties. This was because they were now optional.
However `keytool` does REQUIRE these parameters when we use the `-ks`
or `KeyStore` argument.

If a user does not pass these arguments they get the following error

```
    error XAAAS7001: System.NullReferenceException: Object reference not set to an instance of an object.
    error XAAAS7001: at Xamarin.Android.Tasks.AndroidApkSigner.AddStorePass(CommandLineBuilder cmd, String cmdLineSwitch, String value)
    error XAAAS7001: at Xamarin.Android.Tasks.AndroidApkSigner.GenerateCommandLineCommands()
```

This is because the `KeyPass` or `StorePass` are `null` and the `AddStorePass`
function is not handling that.

So what we should do is when the `KeyStore` argument is being used we should
error out if `KeyPass` or `StorePass` are empty or `null`.
@jonathanpeppers
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jonpryor jonpryor merged commit 27e91bb into xamarin:main Jul 29, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NullReferenceException in Xamarin.Android.Common.targets
3 participants