https://saxonica.plan.io/https://saxonica.plan.io/favicon.ico2022-05-23T21:21:54ZSaxonica Developer CommunitySaxon - Support #5534: SaxonCS crashes on Androidhttps://saxonica.plan.io/issues/5534?journal_id=208362022-05-23T21:21:54ZMartin Honnenmartin.honnen@gmx.de
<ul><li><strong>File</strong> <a href="/attachments/56684">SaxonCS113MAUIGATest1SansLicenseFile.zip</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/56684/SaxonCS113MAUIGATest1SansLicenseFile.zip">SaxonCS113MAUIGATest1SansLicenseFile.zip</a> added</li></ul><p>I attach a minimal MAUI project that runs fine for me under Windows (after adding a saxon-license.lic file to the project and marking it in Visual Studio with build action "MAUI asset") but crashes on Android when any of the buttons is clicked (which try to use XPath or XSLT or only to create an XdmAtomicValue).</p> Saxon - Support #5534: SaxonCS crashes on Androidhttps://saxonica.plan.io/issues/5534?journal_id=211552022-06-25T13:18:38ZMichael Kaymike@saxonica.com
<ul></ul><p>Note to self: see <a href="https://blog.jetbrains.com/dotnet/2022/05/25/macos-environment-setup-for-maui-development/" class="external">https://blog.jetbrains.com/dotnet/2022/05/25/macos-environment-setup-for-maui-development/</a></p> Saxon - Support #5534: SaxonCS crashes on Androidhttps://saxonica.plan.io/issues/5534?journal_id=218702022-09-28T16:02:05ZMartin Honnenmartin.honnen@gmx.de
<ul></ul><p>The MS guys seem to get to the bottom of the crash: <a href="https://github.com/dotnet/maui/issues/6811#issuecomment-1261118608" class="external">https://github.com/dotnet/maui/issues/6811#issuecomment-1261118608</a>. Now idea whether that means they can fix it.</p> Saxon - Support #5534: SaxonCS crashes on Androidhttps://saxonica.plan.io/issues/5534?journal_id=218772022-09-29T17:59:59ZMartin Honnenmartin.honnen@gmx.de
<ul></ul><p>Looks like the fix (or at least a fix) might make it into .NET 6 <a href="https://github.com/dotnet/runtime/pull/76327" class="external">https://github.com/dotnet/runtime/pull/76327</a> and .NET 7. So with the next .NET update I probably have another shot at trying to run SaxonCS under Android.</p> Saxon - Support #5534: SaxonCS crashes on Androidhttps://saxonica.plan.io/issues/5534?journal_id=219222022-10-03T22:31:47ZMartin Honnenmartin.honnen@gmx.de
<ul></ul><p>I am now trying to run on a Mac M1 arm64 with Mono in a console app, there I at least get some stack trace of .NET code before the crash:</p>
<pre><code> Managed Stacktrace:
=================================================================
at <unknown> <0xffffffff>
at <unknown> <0xffffffff>
at System.Object:__icall_wrapper_mono_generic_class_init <0x00007>
at System.Impl.Helpers.DotNetPullProvider:getAttributes <0x0018f>
at Saxon.Hej.pull.PullPushTee:copyEvent <0x002df>
at Saxon.Hej.pull.PullPushTee:next <0x00043>
at Saxon.Hej.pull.PullConsumer:consume <0x00067>
at Saxon.Hej.pull.PullPushCopier:copy <0x000db>
at Saxon.Hej.pull.PullSource:deliver <0x00123>
at Saxon.Hej.event.Sender:send <0x0050b>
at Saxon.Hej.Configuration:buildDocumentTree <0x00303>
at Saxon.Hej.regex.charclass.Categories:build <0x00217>
at Saxon.Hej.regex.charclass.Categories:getCategory <0x0008b>
at Saxon.Hej.regex.charclass.Categories:.cctor <0x00507>
at System.Object:runtime_invoke_void <0x0007f>
at <unknown> <0xffffffff>
at <unknown> <0xffffffff>
at Saxon.Hej.regex.RECompiler:parseCharacterClass <0x0035f>
at Saxon.Hej.regex.RECompiler:parseTerminal <0x00337>
at Saxon.Hej.regex.RECompiler:piece <0x0005b>
at Saxon.Hej.regex.RECompiler:parseBranch <0x00083>
at Saxon.Hej.regex.RECompiler:parseExpr <0x001db>
at Saxon.Hej.regex.RECompiler:compile <0x0036f>
at Saxon.Hej.regex.ARegularExpression:.ctor <0x001b3>
at Saxon.Hej.regex.ARegularExpression:compile <0x0005f>
at Saxon.Hej.value.Whitespace:.cctor <0x0003f>
at System.Object:runtime_invoke_void <0x0007f>
at <unknown> <0xffffffff>
at <unknown> <0xffffffff>
at Saxon.Hej.value.GDateValue:setLexicalValue <0x00057>
at Saxon.Hej.value.DateValue:.ctor <0x0004f>
at Saxon.Hej.value.DateValue:.ctor <0x00043>
at License:daysLeft <0x0013f>
at Saxon.Eej.config.Verifier:configure <0x0043b>
at Saxon.Eej.config.Verifier:readLicenseFile <0x0006f>
at Saxon.Eej.config.Verifier:loadLicense <0x00103>
at Saxon.Impl.Overrides.Verifier:loadLicense <0x00053>
at Saxon.Eej.config.Verifier:loadPrimaryLicense <0x0005f>
at Saxon.Eej.config.ProfessionalConfiguration:loadLicense <0x0003b>
at Saxon.Eej.config.EnterpriseConfiguration:checkLicensedFeature <0x001ef>
at Saxon.Api.Processor:checkLicense <0x00067>
at Saxon.Api.Processor:NewXPathCompiler <0x0002f>
at Program:<Main>$ <0x00143>
</code></pre>
<p>I am curious, is that stack trace with regular expression classes
at Saxon.Hej.regex.charclass.Categories:build <0x00217>
at Saxon.Hej.regex.charclass.Categories:getCategory <0x0008b>
at Saxon.Hej.regex.charclass.Categories:.cctor
part of Saxon's attempt to check its license or is that just infrastructure set up for the XPath evaluation the program tries?</p>
<p>C# code is e.g.</p>
<pre><code class="csharp syntaxhl" data-language="csharp"><span class="k">using</span> <span class="nn">Saxon.Api</span><span class="p">;</span>
<span class="n">Console</span><span class="p">.</span><span class="nf">WriteLine</span><span class="p">(</span><span class="s">$"</span><span class="p">{</span><span class="n">Environment</span><span class="p">.</span><span class="n">Version</span><span class="p">}</span><span class="s"> </span><span class="p">{</span><span class="n">Environment</span><span class="p">.</span><span class="n">OSVersion</span><span class="p">}</span><span class="s">"</span><span class="p">);</span>
<span class="kt">var</span> <span class="n">processor</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">Processor</span><span class="p">(</span><span class="k">true</span><span class="p">);</span>
<span class="n">Console</span><span class="p">.</span><span class="nf">WriteLine</span><span class="p">(</span><span class="s">$"</span><span class="p">{</span><span class="n">processor</span><span class="p">.</span><span class="n">ProductTitle</span><span class="p">}</span><span class="s"> </span><span class="p">{</span><span class="n">processor</span><span class="p">.</span><span class="n">ProductVersion</span><span class="p">}</span><span class="s">"</span><span class="p">);</span>
<span class="n">Console</span><span class="p">.</span><span class="nf">WriteLine</span><span class="p">(</span><span class="s">$"current-dateTime(): </span><span class="p">{</span><span class="n">processor</span><span class="p">.</span><span class="nf">NewXPathCompiler</span><span class="p">().</span><span class="nf">Evaluate</span><span class="p">(</span><span class="s">"current-dateTime()"</span><span class="p">,</span> <span class="k">null</span><span class="p">)}</span><span class="s">"</span><span class="p">);</span>
</code></pre>
<p>It seems to run with Mono you do e.g. <code>dotnet run -p:UseMonoRuntime=true --self-contained -r RID</code> e.g. on this M1 arm64 Mac OS 12 <code>dotnet run -p:UseMonoRuntime=true --self-contained -r osx.12-arm64</code>.</p>
<p>I so far don't understand whether that is comparable to run under Android but it is so much easier to use a command line app than to have all that effort to write a MAUI app. And the above approach seems to be what the MS guy fixing the bug within the .NET runtime does for his reduced test case anyway, thus if a new, fixed .NET 7 (or perhaps, if the fix also makes it into a .NET 6 update, .NET 6) is released, it will be easier to check this way whether the fix allows running SaxonCS.</p> Saxon - Support #5534: SaxonCS crashes on Androidhttps://saxonica.plan.io/issues/5534?journal_id=219232022-10-04T05:28:13ZMichael Kaymike@saxonica.com
<ul></ul><p>It's reading the license file (successfully, it seems), and testing whether it has expired. To do this it uses the DateValue class to process the expiry date, and this in turn invokes the Whitespace class.</p>
<p>The Whitespace class in Saxon 11 has a couple of static variables that are pre-compiled regular expressions [this is no longer the case on the 12.x branch], so this invokes initialisation of the regex engine, which involves reading and parsing the embedded <code>categories.xml</code> file which holds Unicode character data. This is the first use of an embedded resource file and we're rather used to it showing up any build problems.</p>
<p>The stack trace suggests to me that the categories.xml file has been successfully located, and that the error occurs trying to parse it with the XML Reader. In fact, it looks as if parsing has started successfully, because we must have successfully retrieved a start tag before we call <code>getAttributes()</code>. The <code>getAttributes()</code> method makes various calls on the <code>XmlReader</code>, and one of these calls is crashing.</p> Saxon - Support #5534: SaxonCS crashes on Androidhttps://saxonica.plan.io/issues/5534?journal_id=219842022-10-12T07:57:41ZMartin Honnenmartin.honnen@gmx.de
<ul></ul><p>.NET 7 RC 2 (release candidate 2) came out yesterday but unfortunately the fix the Microsoft guy(s) created due to my bug report didn't end up in this release candidate, so no progress here, other than their statement that the fix is slated for the final .NET 7 released in November. Unfortunately, as far as I have asked and got answers, they have only tested that their test case(s) do work with the fix, but didn't check whether SaxonCS also runs, so whether that fixed runtime problem was the only problem preventing the use of SaxonCS under Android or the Mono runtime remains to be seen.</p> Saxon - Support #5534: SaxonCS crashes on Androidhttps://saxonica.plan.io/issues/5534?journal_id=219852022-10-12T08:17:32ZMichael Kaymike@saxonica.com
<ul></ul><p>Thanks for your efforts on this.</p> Saxon - Support #5534: SaxonCS crashes on Androidhttps://saxonica.plan.io/issues/5534?journal_id=220812022-11-08T21:00:44ZMartin Honnenmartin.honnen@gmx.de
<ul></ul><p>With the .NET 7 GA release of today and also with today's Windows/Microsoft patch day .NET 6 update my pet projects trying to use SaxonCS with MAUI and .NET don't crash any longer under Android emulators on Windows. So Microsoft's @lambdageek somehow managed to identify and isolate the core problem of SaxonCS's use of the Mono runtime in <a href="https://github.com/dotnet/runtime/issues/76312" class="external">https://github.com/dotnet/runtime/issues/76312</a> and his fix, now that it has made its way into the official .NET releases, opens up some SaxonCS and .NET cross-platform feeling by being able to write code in C# that runs under Windows and Android. If there weren't the license algorithm problem with MacCatalyst it would probably also work on iOS and MacOS, we'll might be able to see once there is a SaxonCS HE release where the license algorithm problems doesn't occur.</p>
<p>I will do some more testing in the next days to see whether some more serious XSLT/XQuery than the trivial tests I have so far work under Android but will close this issue unless I find some other crash.</p> Saxon - Support #5534: SaxonCS crashes on Androidhttps://saxonica.plan.io/issues/5534?journal_id=221062022-11-14T10:41:55ZMartin Honnenmartin.honnen@gmx.de
<ul></ul><p>As unit testing is so far not supported for MAUI/Android and .NET 7 or 6 I can't run any test suite through SaxonCS on Android, but the originally reported crash is definitely gone with .NET 7 GA and the .NET 6 November update so this can be closed as fixed/resolved.</p> Saxon - Support #5534: SaxonCS crashes on Androidhttps://saxonica.plan.io/issues/5534?journal_id=240632023-06-16T17:01:13ZMichael Kaymike@saxonica.com
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Closed</i></li></ul>