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] Add XA1031 error for AndroidHttpClientHandlerType #7448

Merged
merged 6 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions Documentation/guides/messages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ or 'Help->Report a Problem' in Visual Studio for Mac.
+ [XA1027](xa1027.md): The 'EnableProguard' MSBuild property is set to 'true' and the 'AndroidLinkTool' MSBuild property is empty, so 'AndroidLinkTool' will default to 'proguard'.
+ [XA1028](xa1028.md): The 'AndroidEnableProguard' MSBuild property is set to 'true' and the 'AndroidLinkTool' MSBuild property is empty, so 'AndroidLinkTool' will default to 'proguard'.
+ [XA1029](xa1029.md): The 'AotAssemblies' MSBuild property is deprecated. Edit the project file in a text editor to remove this property, and use the 'RunAOTCompilation' MSBuild property instead.
+ [XA1031](xa1031.md): The 'AndroidHttpClientHandlerType' has an invalid value.
+ [XA1032](xa1032.md):Failed to resolve '{0}' from '{1}'. Please check your `AndroidHttpClientHandlerType` setting.
+ [XA1033](xa1033.md): Could not resolve '{0}'. Please check your `AndroidHttpClientHandlerType` setting.

## XA2xxx: Linker

Expand Down
20 changes: 20 additions & 0 deletions Documentation/guides/messages/xa1031.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Xamarin.Android error XA1031
description: XA1031 error code
ms.date: 10/10/2022
---
# Xamarin.Android error XA1031

## Example messages

```
The 'AndroidHttpClientHandlerType' property value 'Foo.Bar.HttpHander, MyApp' must derive from 'System.Net.Http.HttpMessageHandler'.
Please change the value to an assembly-qualifed type name which inherits from '{1}' or remove the property completely.
```

## Solution

Edit your csproj directly and change the 'AndroidHttpClientHandlerType' to
a valid value.

Valid values can be found at `~/android/deploy-test/building-apps/build-properties.md#AndroidHttpClientHandlerType`.
19 changes: 19 additions & 0 deletions Documentation/guides/messages/xa1032.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: Xamarin.Android error XA1032
description: XA1032 error code
ms.date: 10/10/2022
---
# Xamarin.Android error XA1032

## Example messages

```
Failed to resolve '{0}' from '{1}'. Please check your `AndroidHttpClientHandlerType` setting.
```

## Solution

Edit your csproj directly and change the 'AndroidHttpClientHandlerType' to
a valid value.

Valid values can be found at `~/android/deploy-test/building-apps/build-properties.md#AndroidHttpClientHandlerType`.
19 changes: 19 additions & 0 deletions Documentation/guides/messages/xa1033.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: Xamarin.Android error XA1033
description: XA1033 error code
ms.date: 10/10/2022
---
# Xamarin.Android error XA1033

## Example messages

```
Could not resolve '{0}'. Please check your `AndroidHttpClientHandlerType` setting.
```

## Solution

Edit your csproj directly and change the 'AndroidHttpClientHandlerType' to
a valid value.

Valid values can be found at `~/android/deploy-test/building-apps/build-properties.md#AndroidHttpClientHandlerType`.
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,11 @@ projects, these properties are set in Xamarin.Android.Legacy.targets.
_IncludeLayoutBindingSources;
AddLibraryJarsToBind;
$(CompileDependsOn);
_CheckAndroidHttpClientHandlerType;
</CompileDependsOn>
<CoreCompileDependsOn>
UpdateGeneratedFiles;
$(CoreCompileDependsOn)
$(CoreCompileDependsOn);
</CoreCompileDependsOn>
<DeferredBuildDependsOn>
$(DeferredBuildDependsOn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
<HttpActivityPropagationSupport Condition="'$(HttpActivityPropagationSupport)' == ''">false</HttpActivityPropagationSupport>
<InvariantGlobalization Condition="'$(InvariantGlobalization)' == ''">false</InvariantGlobalization>
<StartupHookSupport Condition="'$(StartupHookSupport)' == ''">false</StartupHookSupport>
<UseNativeHttpHandler Condition=" $(AndroidHttpClientHandlerType.Contains ('System.Net.Http.SocketsHttpHandler')) And '$(UseNativeHttpHandler)' == '' ">false</UseNativeHttpHandler>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dellis1972 : this feels like something that should be called out in the commit message. What's the rationale here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is left over. But we got info from the runtime team that if a user defines System.Net.Http.SocketsHttpHandler' as the handler type they MUST use set the UseNativeHttpHandler msbuild property. Otherwise it doesn't work.

This is where the conversaton took place https://discord.com/channels/732297728826277939/732297837953679412/1029777522897993748

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove it ("this is left over") or keep it ("extract rationale from Discord")?

<UseNativeHttpHandler Condition="'$(UseNativeHttpHandler)' == ''">true</UseNativeHttpHandler>
<_AggressiveAttributeTrimming Condition="'$(_AggressiveAttributeTrimming)' == ''">true</_AggressiveAttributeTrimming>
<NullabilityInfoContextSupport Condition="'$(NullabilityInfoContextSupport)' == ''">false</NullabilityInfoContextSupport>
Expand Down