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

NSInvalidArgumentException when sending multipart content over HTTP #15860

Closed
tipa opened this issue Sep 5, 2022 · 15 comments · Fixed by #18011
Closed

NSInvalidArgumentException when sending multipart content over HTTP #15860

tipa opened this issue Sep 5, 2022 · 15 comments · Fixed by #18011
Assignees
Labels
bug If an issue is a bug or a pull request a bug fix
Milestone

Comments

@tipa
Copy link

tipa commented Sep 5, 2022

Steps to Reproduce

  1. Download example project: test.zip
  2. Register Client app in Google console & enter client ID in example project in "ViewController.cs"
  3. Execute app & authorise client

Expected Behavior

No exception, file upload succeeds

Actual Behavior

2022-09-05 09:34:20.133318+0200 test[4083:85862] Xamarin.iOS: Received unhandled ObjectiveC exception: NSInvalidArgumentException *** -streamStatus only defined for abstract class. Define -[System_Net_Http_NSUrlSessionHandler_WrappedNSInputStream streamStatus]!

Additional comments

Environment

Version information
Visual Studio Community 2022 for Mac Preview
Version 17.4 Preview (17.4 build 715)
Installation UUID: 77c9a8af-734f-4ecb-bc80-fd2b65c91026

Runtime
.NET 6.0.5 (64-bit)
Architecture: Arm64

Roslyn (Language Service)
4.4.0-1.22371.1+c07f2571612b471671c809b5b0db59b0c37aab57

NuGet
Version: 6.2.1.2

.NET SDK (Arm64)
SDK: /usr/local/share/dotnet/sdk/6.0.400/Sdks
SDK Version: 6.0.400
MSBuild SDKs: /Applications/Visual Studio (Preview).app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET Runtime (Arm64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	6.0.8
	6.0.0

.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/x64/dotnet
Runtime Version: 6.0.8

Xamarin.Profiler
Version: 1.8.0.19
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Xamarin Designer
Version: 17.4.0.32
Hash: 439b92ed7b
Branch: remotes/origin/d17-4
Build date: 2022-08-04 16:29:17 UTC

Xamarin.Android
Not Installed

Microsoft Build of OpenJDK
Java SDK: Not Found

Eclipse Temurin JDK
Java SDK: Not Found

Android SDK Manager
Version: 17.4.0.24
Hash: b3b6672
Branch: remotes/origin/HEAD~1
Build date: 2022-08-04 16:29:21 UTC

Android Device Manager
Version: 0.0.0.1179
Hash: 0f220c0
Branch: main
Build date: 2022-08-04 16:29:21 UTC

Apple Developer Tools
Xcode 13.4.1 (20504)
Build 13F100

Xamarin.Mac
Version: 8.12.0.2 (Visual Studio Community)
Hash: 87f98a75e
Branch: d17-3
Build date: 2022-07-25 20:18:54-0400

Xamarin.iOS
Version: 15.12.0.2 (Visual Studio Community)
Hash: 87f98a75e
Branch: d17-3
Build date: 2022-07-25 20:18:55-0400

Build Information
Release ID: 1704000715
Git revision: 09071dadfc1b81e4f0e2c9505cd8a5ef0b41d312
Build date: 2022-08-04 16:26:39+00
Build branch: release-17.4
Build lane: release-17.4

Operating System
Mac OS X 12.5.1
Darwin 21.6.0 Darwin Kernel Version 21.6.0
    Wed Aug 10 14:28:35 PDT 2022
    root:xnu-8020.141.5~2/RELEASE_ARM64_T8101 arm64


@mandel-macaque mandel-macaque self-assigned this Sep 6, 2022
@mandel-macaque mandel-macaque added this to the Future milestone Sep 6, 2022
@tipa
Copy link
Author

tipa commented Apr 1, 2023

Bug is still present when building a .NET7 iOS app

@rolfbjarne rolfbjarne added the bug If an issue is a bug or a pull request a bug fix label Apr 10, 2023
rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this issue Apr 10, 2023
…et#15860.

Preserve all members of WrappedNSInputStream, and mark it as a non-direct
binding class, so that the linker doesn't trim away any virtual overrides,
since they're actually necessary.

Fixes dotnet#15860.
rolfbjarne added a commit that referenced this issue Apr 11, 2023
…. (#18011)

Preserve all members of WrappedNSInputStream, and mark it as a
non-direct binding class, so that the linker doesn't trim away any virtual
overrides, since they're actually necessary.

Fixes #15860.
vs-mobiletools-engineering-service2 pushed a commit to vs-mobiletools-engineering-service2/xamarin-macios that referenced this issue Apr 11, 2023
…et#15860.

Preserve all members of WrappedNSInputStream, and mark it as a non-direct
binding class, so that the linker doesn't trim away any virtual overrides,
since they're actually necessary.

Fixes dotnet#15860.
vs-mobiletools-engineering-service2 pushed a commit to vs-mobiletools-engineering-service2/xamarin-macios that referenced this issue Apr 11, 2023
…et#15860.

Preserve all members of WrappedNSInputStream, and mark it as a non-direct
binding class, so that the linker doesn't trim away any virtual overrides,
since they're actually necessary.

Fixes dotnet#15860.
vs-mobiletools-engineering-service2 pushed a commit to vs-mobiletools-engineering-service2/xamarin-macios that referenced this issue Apr 11, 2023
…et#15860.

Preserve all members of WrappedNSInputStream, and mark it as a non-direct
binding class, so that the linker doesn't trim away any virtual overrides,
since they're actually necessary.

Fixes dotnet#15860.
dalexsoto pushed a commit that referenced this issue Apr 11, 2023
…pedNSInputStream. Fixes #15860. (#18020)

Preserve all members of WrappedNSInputStream, and mark it as a
non-direct
binding class, so that the linker doesn't trim away any virtual
overrides,
since they're actually necessary.

Fixes #15860.


Backport of #18011

Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
rolfbjarne added a commit that referenced this issue Apr 11, 2023
…Fixes #15860. (#18019)

Preserve all members of WrappedNSInputStream, and mark it as a
non-direct binding class, so that the linker doesn't trim away any virtual
overrides, since they're actually necessary.

Fixes #15860.


Backport of #18011

Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
rolfbjarne added a commit that referenced this issue Apr 11, 2023
…pedNSInputStream. Fixes #15860. (#18018)

Preserve all members of WrappedNSInputStream, and mark it as a
non-direct binding class, so that the linker doesn't trim away any virtual
overrides, since they're actually necessary.

Fixes #15860.

Backport of #18011

Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
@navi121
Copy link

navi121 commented Apr 27, 2023

I am facing same issue.
ObjectiveC exception: NSInvalidArgumentException *** -streamStatus only defined for abstract class. Define -[System_Net_Http_NSUrlSessionHandler_WrappedNSInputStream streamStatus]!

I am using Xamarin Forms - 5.0.0.2578
TargetFramework - netstandard2.1

@navi121
Copy link

navi121 commented Apr 27, 2023

This has been blocking my work. May I know when this resolved version is been released?

@rolfbjarne
Copy link
Member

This has been blocking my work. May I know when this resolved version is been released?

I believe this will be shipped together with our support for Xcode 14.3 - and see this issue for that: #17561

@navi121
Copy link

navi121 commented Apr 28, 2023

Is there any estimated date for release to that issue ?

@tipa
Copy link
Author

tipa commented May 2, 2023

This crash is still happening with the latest versions of .NET / Xamarin / VS4Mac

@rolfbjarne
Copy link
Member

@tipa can you show the exact versions you used?

@tipa
Copy link
Author

tipa commented May 3, 2023

Visual Studio Community 2022 for Mac Preview
Version 17.6 Preview (17.6 build 1496)
Installation UUID: 92d6c149-e164-4fec-8974-dd98b072279c

Runtime
.NET 7.0.3 (64-bit)
Architecture: Arm64
Microsoft.macOS.Sdk 13.1.1007; git-rev-head:8afca776a0a96613dfb7200e0917bb57f9ed5583; git-branch:release/7.0.1xx-xcode14.2

Roslyn (Language Service)
4.6.0-3.23180.6+99e956e42697a6dd886d1e12478ea2b27cceacfa

NuGet
Version: 6.4.0.117

.NET SDK (Arm64)
SDK: /usr/local/share/dotnet/sdk/7.0.203/Sdks
SDK Versions:
	7.0.203
	7.0.202
	7.0.201
MSBuild SDKs: /Applications/Visual Studio (Preview).app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET Runtime (Arm64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	7.0.5
	7.0.4
	7.0.3

Xamarin.Profiler
'/Applications/Xamarin Profiler.app' not found

Updater
Version: 11

Apple Developer Tools
Xcode: 14.3 21812
Build: 14E222b

Xamarin.Mac
Version: 9.3.0.6 Visual Studio Community
Hash: 97731c92c
Branch: xcode14.3
Build date: 2023-04-11 22:38:35-0400

Xamarin.iOS
Version: 16.4.0.6 Visual Studio Community
Hash: 97731c92c
Branch: xcode14.3
Build date: 2023-04-11 22:38:36-0400

Xamarin Designer
Version: 17.6.3.9
Hash: 2648399ae8
Branch: remotes/origin/d17-6
Build date: 2023-04-27 00:18:22 UTC

Xamarin.Android
Not Installed

Microsoft Build of OpenJDK
Java SDK: Not Found

Eclipse Temurin JDK
Java SDK: Not Found

Android SDK Manager
Version: 17.6.0.50
Hash: a715dca
Branch: HEAD
Build date: 2023-04-27 00:18:27 UTC

Android Device Manager
Version: 0.0.0.1309
Hash: 06e3e77
Branch: HEAD
Build date: 2023-04-27 00:18:27 UTC

Build Information
Release ID: 1706001496
Git revision: 7673a20cf2d7409180fbdc86d3fd9fc7cc17a1e9
Build date: 2023-04-27 00:16:36+00
Build branch: release-17.6
Build lane: release-17.6

Operating System
Mac OS X 13.3.1
Darwin 22.4.0 Darwin Kernel Version 22.4.0
    Mon Mar  6 21:00:41 PST 2023
    root:xnu-8796.101.5~3/RELEASE_ARM64_T8103 arm64

@rolfbjarne
Copy link
Member

This crash is still happening with the latest versions of .NET / Xamarin / VS4Mac

Just to confirm: you saw this error with an app built with legacy Xamarin.iOS?

@tipa
Copy link
Author

tipa commented May 4, 2023

No, I fully transitioned to "new .NET 7 for iOS". I don't know if it also happens on legacy Xamarin

@rolfbjarne
Copy link
Member

No, I fully transitioned to "new .NET 7 for iOS". I don't know if it also happens on legacy Xamarin

OK, that makes sense then, because we haven't published packages with the fix for .NET 7 yet.

@navi121
Copy link

navi121 commented May 19, 2023

Is this issue is been fixed and released? I have been blocked for a long time

@rolfbjarne
Copy link
Member

Is this issue is been fixed and released? I have been blocked for a long time

Yes, it's been released now. It's included in this release for .NET: https://github.com/xamarin/xamarin-macios/releases/tag/dotnet-7.0.2xx-xcode14.3-7060

@tipa
Copy link
Author

tipa commented May 21, 2023

@rolfbjarne that's great news - thanks!
How can I make sure that I have this servicing update installed? When building a "normal" iOS app with .NET (not MAUI), I don't reference these Microsoft.iOS.Sdk NuGet packages, or should I?

@rolfbjarne
Copy link
Member

How can I make sure that I have this servicing update installed?

dotnet workload list should show something like this:

ios 16.4.7060/7.0.100 SDK 7.0.100

(the important part is the first version, 16.4.7060).

When building a "normal" iOS app with .NET (not MAUI), I don't reference these Microsoft.iOS.Sdk NuGet packages, or should I?

Yes, when building for iOS with .NET (with or without MAUI), you'll reference the Microsoft.iOS.Sdk NuGet package.

@ghost ghost locked as resolved and limited conversation to collaborators Jun 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug If an issue is a bug or a pull request a bug fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants