maui-hybridwebview
Installation
SKILL.md
HybridWebView in .NET MAUI
HybridWebView hosts HTML/JS/CSS content inside a .NET MAUI app with bidirectional C#↔JS communication. It is not a general browser control — it is designed for local web content shipped with the app.
Common gotchas
| Issue | Fix |
|---|---|
| Blank white screen | Web assets missing from Resources/Raw/wwwroot or DefaultFile not set |
| JS interop silently fails | Missing <script src="_hwv/HybridWebView.js"></script> in HTML |
InvokeJavaScriptAsync returns null |
Return type missing [JsonSerializable] attribute in JsonSerializerContext |
| JS → C# calls do nothing | SetInvokeJavaScriptTarget not called before JS invokes C# methods |
| Serialization crash with trimming | Not using source-generated JsonSerializerContext |
⚠️ Bridge script is mandatory
The HTML page must include the bridge script before any app scripts:
Related skills