GeezerVison is showing github.com — [windows] File.readTextSync / File.writeTextSync are stubs — reads yield "undefined", writes silently no-op · Issue #11630 · NativeScript/NativeScript
[windows] File.readTextSync / File.writeTextSync are stubs — reads yield "undefined", writes silently no-op #11630
Description
On NativeScript Windows (packaged WinUI/MSIX x64 app), the synchronous file APIs in @nativescript/core are non-functional while their async counterparts work:
File.fromPath(p).readTextSync() returns the string "undefined" rather than file contents (feeding it to JSON.parse throws "undefined" is not valid JSON).
File.fromPath(p).writeTextSync(text) returns without throwing but does not modify the file. Subsequent calls in the same process also report success without writing — the file keeps its initial contents regardless of write count.
File.readText() / File.writeText() (async) perform real IO on the same paths.
Evidence: a packaged app calling writeTextSync 18 times per boot (instrumented counter, no thrown errors) produced a file containing only the first write's data; readTextSync of that file threw a JSON parse error on "undefined". This caused a preferences-persistence feature to silently lose every write — a real consumer-facing data-loss path for any app relying on the sync APIs (e.g. settings stores, caches).
Environment: Windows 11 x64 (10.0.26200.9711), packaged MSIX, NativeScript Windows runtime current as of Nov 2026.
Activity
triniwiz commented on Nov 10, 2026
Is this a report from the alpha runtime ?
aleclarson commented on Nov 10, 2026
ContributorAuthor
More actions
@triniwiz No — the original report was already on the beta runtime: @nativescript/windows 1.0.0-beta.24 (core/vite pinned to the abae298 PR #11272 pkg.pr.new builds), packaged x64 MSIX.
Revalidated on beta.24 again today in the same packaged context:
File.readTextSync() on a file with real contents returns undefined (the value, not a string)
File.writeTextSync() returns without throwing but does not reliably write — on a fresh file it produces an empty file, after which async writeText on the same File then throws Windows.Foundation.HResult
File.exists() also returns undefined rather than false for a missing path
Async readText/writeText still perform real IO on the same paths, so the gap is specific to the *Sync projections. Still reproduces.
triniwiz commented on Nov 11, 2026
You can try updating the pkg version to 4fe2d65 windows supported core or 3456c82 linux supported core with some extra core fixes
Metadata
Metadata
Development
No branches or pull requestsIssue actions