-
-
Notifications
You must be signed in to change notification settings - Fork 235
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
Fix Boilerplate issue with signalr on android in prod env (#9152) #9153
Fix Boilerplate issue with signalr on android in prod env (#9152) #9153
Conversation
WalkthroughThe changes made in the pull request focus on modifying the project file for a .NET MAUI application. Key updates include the introduction of new build targets, specifically Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj (1)
Line range hint
164-173
: Consider enhancing build robustnessThe build targets are well-implemented but could be made more resilient:
- The SASS compilation assumes Node.js is installed and the Core project's node_modules are available
- The relative path to node_modules might break in different build environments
Consider adding:
- Node.js installation check
- SASS installation fallback
- More flexible path resolution
<Target Name="BuildCssFiles"> + <Error Text="Node.js is required for SASS compilation. Please install Node.js: https://nodejs.org" Condition="!Exists('$(NodePath)')" /> + <Exec Command="npm install -g sass" Condition="!Exists('../Boilerplate.Client.Core/node_modules/.bin/sass')" StandardOutputImportance="high" /> <Exec Command="../Boilerplate.Client.Core/node_modules/.bin/sass .:. --style compressed --load-path=. --silence-deprecation=import" StandardOutputImportance="high" StandardErrorImportance="high" LogStandardErrorAsError="true" /> </Target>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj
(3 hunks)
🔇 Additional comments (3)
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj (3)
174-180
: Excellent fix for SignalR Android production issue!
This change addresses the SignalR connectivity issues on Android in production by excluding System.Net.Sockets.dll
from AOT compilation when LLVM is enabled. The implementation:
- Correctly hooks into the Android AOT compilation process
- Only applies to production builds with LLVM enabled
- Follows the solution outlined in WebSocket exception with LLVM and full AOT Enabled in .NET Android App dotnet/runtime#104599
This should resolve the SignalR connection problems without any negative side effects, as the DLL will still be available at runtime.
107-107
: LGTM: Using directives are well-organized
The Using directives provide a comprehensive set of namespaces needed for the application, improving code readability and maintainability.
174-180
: Verify SignalR configuration in related files
While the fix for the Android AOT compilation issue is solid, let's verify that all SignalR-related configurations are consistent across the solution.
✅ Verification successful
Let me check the actual implementations to better understand the SignalR and Socket usage.
SignalR configuration is consistent, AOT fix is isolated and safe
The verification shows that:
- SignalR is properly configured on both client and server sides
- The client uses WebSocket transport explicitly, avoiding problematic transports
- The Socket usage in Maui is only for imports and doesn't conflict with SignalR
- The AOT compilation fix in the csproj is specifically targeting the known runtime issue with System.Net.Sockets.dll
The Android AOT compilation fix is correctly scoped and won't affect the SignalR functionality, which is using WebSockets transport appropriately.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for SignalR configurations and usage
echo "Checking for SignalR configurations..."
rg -l "AddSignalR|UseSignalR|HubConnection|IHubContext" --type-add 'config:*.{json,cs,csproj}' -t config
echo "Checking for any manual Socket handling that might conflict..."
rg -l "Socket|NetworkStream" --type cs
Length of output: 1101
Script:
#!/bin/bash
# Check SignalR implementations
echo "=== ClientAppCoordinator.cs SignalR usage ==="
rg "HubConnection|IHubContext" -A 5 "src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/ClientAppCoordinator.cs"
echo -e "\n=== Program.Services.cs SignalR configuration ==="
rg "AddSignalR|UseSignalR" -A 5 "src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs"
echo -e "\n=== Socket usage in MauiLocalHttpServer ==="
rg "Socket|NetworkStream" -A 5 "src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Services/MauiLocalHttpServer.cs"
Length of output: 2631
Hi guys, one other issue you might want to track - it doesn't break things, but heavily impacts MAUI Blazor app performance (esp. startup) on Android: dotnet/runtime#101135 (comment) |
This closes #9152
Summary by CodeRabbit
New Features
Bug Fixes