| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…in apps
Class extension (classic and napi engines)
- .NET and unsealed WinRT classes can be extended with ES2015 `class`,
`Class.extend()`, `@NativeClass`, TypeScript ES5 output and
`Object.extend({ interfaces })`. Native code calling an overridden member
reaches the JS override (including XAML's MeasureOverride/ArrangeOverride/
OnApplyTemplate on composed WinUI objects).
- Constructor arguments select and feed the base constructor; `super.X()` and
`this.super.X()` call the base implementation through emitted non-virtual
`__ns_base_X` methods; protected/abstract members, property accessors,
`instanceof` (subclass and native bases), JS fields and object identity
across native round-trips work; `new Interface({...})` and `@Interfaces`
implement interfaces.
- Instances are collectable: the dispatcher holds the JS object weakly, the
bridge unpins it when the managed object dies, and a JS object is revived
for instances only native code still holds. WinRT UI subclasses stay alive
while in a live XAML tree.
- sbg-generated proxies are no longer built or shipped: the bridge emits the
types at runtime.
Threading
- WinRT delegates, .NET delegates/events, overridden members and Task
continuations invoked on background threads run on the UI thread while the
caller waits (return values and exceptions flow back), in both engines.
- .NET methods returning Task return awaitables instead of blocking the UI
thread.
- Static WinRT events (CompositionTarget.Rendering) can be assigned on class
constructors, so tree mutation from Rendering/LayoutUpdated/SizeChanged is
covered by tests.
C# in apps and plugins
- Root namespaces of app, plugin and NuGet assemblies are globals: C# under
App_Resources/Windows (or a plugin's platforms/windows) is usable from JS by
namespace with no registration.
- JS functions passed for delegates, plain objects for structs, enums,
overloads by parameter type.
- `System` stays the .NET namespace when @nativescript/core assigns its
SystemJS shim.
- Classic engine pumps V8 platform tasks and clears kept objects, so
FinalizationRegistry/WeakRef work (proxied .NET handles are now released).
Template / tooling
- The template runs unpackaged (no ApplicationData without package identity)
and doesn't copy App_Resources C# sources to the output.
- Fix top-level require() of relative modules when the entry isn't a bundle.
Tests
- test-app/: Jasmine-style runtime test app (like the Android/iOS test-apps)
with C# fixtures in App_Resources/Windows/src and a plugin shipping C#
sources; `pwsh test-app/run.ps1` (optionally `-EngineDll` for napi engines).
- dotnet-bridge-tests: JsSubclassTests for the bridge side.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command. ⚙️ Run configuration
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file. Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. ❤️ ShareComment @coderabbitai help to get the list of available commands. |
Sorry, something went wrong.
…alues - WinRT delegates and .NET callbacks created in a worker run on that worker's thread when invoked from another thread (the worker loop now waits on commands, messages and timers). - A callback whose worker has terminated is refused instead of running on a disposed isolate. - Messages a worker posts on its own reach the main thread without it polling. - The classic engine unboxes IPropertyValue results (Tag, PropertySet values) to JS primitives. - test-app: worker and boxing specs; hooks of fully skipped suites don't run.
| Back | FazBrowse Home | New Git URL |
Brings class extension, threading and native C# code on Windows in line with what the iOS and Android runtimes offer, and adds a runtime test app like theirs.
Class extension
JS can extend .NET classes and unsealed WinRT/WinUI classes with ES2015 class, Class.extend(), @NativeClass, TypeScript's ES5 output (__extends / _super.call(this)) and Object.extend({ interfaces }). When native code calls an overridden member, it reaches the JS override; for example, XAML calls MeasureOverride on a JS Panel subclass.
Previously:
What changed:
Threading
C# in apps and plugins
Other fixes
Tests
I also checked end to end with the desktop starter template: the C# file in App_Resources/Windows/src compiled through the CLI, and a JS subclass override was called from C#.
Behaviour changes
Related: CLI NativeScript/nativescript-cli feat/windows-csharp-sources, docs NativeScript/docs docs/windows-extending-threading-csharp.