I have an Angular 7 client-side app that I am running both independently in a browser and within a Windows Forms application using CefSharp (v75.1.141 which is a wrapper for CEF, version 75.1.14+gc81164e+chromium-75.0.3770.100 based on Chromium version 75.0.3770.100). One of my angular services makes a call to the javascript Intl namespace:
- Code: Select all
constructor() {
console.log("FormattersService constructor start");
try {
this.currencyFormatter = new Intl.NumberFormat("en-NZ", { style: "currency", currency: "NZD" });
} catch (error) {
console.error("FormattersService call to Intl.NumberFormat error", error);
}
console.log("FormattersService constructed...after call to Intl.NumberFormat");
}
I've also tried replacing the "en-NZ" with the array ["en-NZ", "en-GB"], also ["en-NZ", "en-GB", "en"], and also just replacing it with "en-GB", all with the same result.
While this service (which is DI into a component) is happily constructed in any browser I've tested it in, it completely bombs in my CefSharp browser form. Logging the console (via ChromiumWebBrowser.ConsoleMessage event) ends with the line:
FormattersService constructor start
i.e. no error is caught, and it doesn't get to the end. The whole app just seems to stop and there's no explanation.
Any help with either using the Intl javascript locales in CefSharp/chromium, or using CefSharp to find out exactly what is going on?
I am aware of the cef locales, and have the en-GB.pak in a locales folder that CefSharp knows about (via CefSettings.LocalsDirPath) and have set Locale to en-GB, but I believe this is not related (i.e. just sets up the "browser" language).
Further to this, I've now removed the dependency on Intl and the FormattersService now gets constructed without a hitch, as do all the other dependencies of my component, but my component now still never makes it to its constructor. I have other similar components/pages that load fine. This really has got me to head+brick wall territory.