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

NSUrlSessionHandler should propagate network exceptions #18459

Merged
merged 5 commits into from
Jun 20, 2023
Merged

NSUrlSessionHandler should propagate network exceptions #18459

merged 5 commits into from
Jun 20, 2023

Conversation

EmilienDup
Copy link
Contributor

fixes #18458

@EmilienDup
Copy link
Contributor Author

@microsoft-github-policy-service agree company="SnagR Ltd."

@rolfbjarne rolfbjarne added the community Community contribution ❤ label Jun 16, 2023
@github-actions
Copy link
Contributor

⚠️ Your code has been reformatted. ⚠️

If this is not desired, add the actions-disable-autoformat label, and revert the reformatting commit.

If files unrelated to your change were modified, try reverting the reformatting commit + merging with the target branch (and push those changes).

@rolfbjarne
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@rolfbjarne
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Comment on lines -938 to -940
// set the stream as finished
inflight.Stream.TrySetReceivedAllData ();

Copy link
Member

Choose a reason for hiding this comment

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

For others, since I had to look into why this a little deeper and is missing some context. This change has no 'difference' in the final result. The reason for it is that TrySetException in the NSUrlSessionDataTaskStream. That method does the following:

			public void TrySetException (Exception e)
			{
				exc = e;
				TrySetReceivedAllData ();
			}

Therefore, in case of an exception, the stream ends up in the same situation. Moving it to the else is probably fixing a run condition in which we set it as completed but the exception is not set in the stream.

@@ -1334,8 +1334,10 @@ public override async Task<int> ReadAsync (byte [] buffer, int offset, int count

while (current is null) {
lock (dataLock) {
if (data.Count == 0 && receivedAllData && position == length)
if (data.Count == 0 && receivedAllData && position == length) {
ThrowIfNeeded (cancellationToken);
Copy link
Member

Choose a reason for hiding this comment

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

Needed, else won't throw +1

@mandel-macaque
Copy link
Member

@rolfbjarne @dalexsoto I believe the is a valid change and the failures in the CI are not related to this commit, but due to an update on the allowed words by Microsoft in the source code, specially in the mon source code:

 Tool: PoliCheck: Rule: 80034 (Term: nuke. TermClass: Cultural. Action: Action : Context = In all other contexts.; ActionRecommendation = <b>REMOVE</b>; Context = When used an an abbreviation of nuclear weapon.; ActionRecommendation = <b>Replace</b> with "nuclear weapon" or "nuclear armament"; ). 
  Term: 'nuke'. Term class: Cultural. Term table: English-9. Position: Line: 137. Context(term at 16): '  displayName: 'Nuke Provisionator Tool Cache''

And some nonsense related to the Mac APIs:

Tool: PoliCheck: Rule: 203588 (Term: Orient. TermClass: Geopolitical. Action: Action : Context = When used in other contexts, such as to refer to positioning.; ActionRecommendation = <b>Leave term unchanged</b>; Context = When used to refer to the geographic region of East Asia.; ActionRecommendation = <b>Replace</b> with "East Asia" or "Asia"; Context = When used to refer to the Microsoft sales region.; ActionRecommendation = <b>Replace</b> with "Asia"; ). 
  Term: 'Orient'. Term class: Geopolitical. Term table: English-9. Position: Line: 261626. Context(term at 34): 'P:MonoMac.WebKit.DomOverflowEvent.Orient'.

@github-actions
Copy link
Contributor

⚠️ Your code has been reformatted. ⚠️

If this is not desired, add the actions-disable-autoformat label, and revert the reformatting commit.

If files unrelated to your change were modified, try reverting the reformatting commit + merging with the target branch (and push those changes).

@rolfbjarne
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build] Windows Integration Tests passed 💻

All Windows Integration Tests passed.

Pipeline on Agent
Hash: 2ed73a4e6cd620b71b373bf617b2b6a4fe3cf3c6 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS M1 - Mac Ventura (13.0) passed 💻

All tests on macOS M1 - Mac Ventura (13.0) passed.

Pipeline on Agent
Hash: [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

📚 [PR Build] Artifacts 📚

Packages generated

View packages

Pipeline on Agent
Hash: [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS M1 - Mac Big Sur (11.5) passed 💻

All tests on macOS M1 - Mac Big Sur (11.5) passed.

Pipeline on Agent
Hash: [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

Legacy Xamarin (No breaking changes)
  • iOS (no change detected)
  • tvOS (no change detected)
  • watchOS (no change detected)
  • macOS (no change detected)
NET (empty diffs)
  • iOS: (empty diff detected)
  • tvOS: (empty diff detected)
  • MacCatalyst: (empty diff detected)
  • macOS: (empty diff detected)

✅ API diff vs stable

Legacy Xamarin (No breaking changes)
.NET (No breaking changes)
Legacy Xamarin (stable) vs .NET

✅ Generator diff

Generator diff is empty

Pipeline on Agent
Hash: 2ed73a4e6cd620b71b373bf617b2b6a4fe3cf3c6 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🚀 [CI Build] Test results 🚀

Test results

✅ All tests passed on VSTS: simulator tests.

🎉 All 235 tests passed 🎉

Tests counts

✅ bcl: All 69 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests: All 1 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 7 tests passed. Html Report (VSDrops) Download
✅ framework: All 8 tests passed. Html Report (VSDrops) Download
✅ generator: All 2 tests passed. Html Report (VSDrops) Download
✅ interdependent_binding_projects: All 7 tests passed. Html Report (VSDrops) Download
✅ install_source: All 1 tests passed. Html Report (VSDrops) Download
✅ introspection: All 8 tests passed. Html Report (VSDrops) Download
✅ linker: All 65 tests passed. Html Report (VSDrops) Download
✅ mac_binding_project: All 1 tests passed. Html Report (VSDrops) Download
✅ mmp: All 2 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ mononative: All 12 tests passed. Html Report (VSDrops) Download
✅ monotouch: All 35 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ mtouch: All 1 tests passed. Html Report (VSDrops) Download
✅ xammac: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 8 tests passed. Html Report (VSDrops) Download
✅ xtro: All 2 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 2ed73a4e6cd620b71b373bf617b2b6a4fe3cf3c6 [PR build]

@rolfbjarne rolfbjarne merged commit 7cea2a8 into xamarin:main Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Community contribution ❤
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] NSUrlSessionHandler doesn't propagate connection error correctly
4 participants