lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shad Storhaug (JIRA)" <>
Subject [jira] [Commented] (LUCENENET-602) Error using Lucene.Net.Facet 4.8.0-beta00005 with Xamarin.iOS
Date Fri, 15 Jun 2018 03:05:00 GMT


Shad Storhaug commented on LUCENENET-602:

Thanks for the report.

I took a look and it really isn't very clear what the future holds for this problem. According
to [Microsoft|]
this is a current issue and it isn't clear whether they intend to address it. However, according
to [this page|] it
sounds like this should be currently supported. Microsoft's documentation was apparently copied
from [this page|], which was last
updated in 2009. Then again, according to [this comment|]:
{quote}As of Mono 2.0, AOT compilation is only supported for non-generic methods. support
for generics is currently under development.
Since I can't seem to find a way to detect whether the AOT compilation is enabled and there
are clear advantages (optimizations) for calling {{System.Collections.Generic.EqualityComparer<T>.Default}}
on other platforms, I ended up wrapping it in a new comparer {{Lucene.Net.Support.EqualityComparer<T>.Default}},
which attempts to call {{System.Collections.Generic.EqualityComparer<T>.Default}} the
first time and if there is an exception it will store a nullable boolean in a static field
to indicate whether value types are supported, or null to indicate the check hasn't yet been
done. After the initial attempt, it will simply call the correct comparer depending on the
state of the boolean. That should fix the issue and also cover the case where it is eventually

This could be improved if there were a specific exception to catch (you didn't include it
in the stack trace) to narrow down the field - right now it catches when any exception is
thrown and the type is a value type, but allows all other exceptions to be thrown.

Version [4.8.0-ci0000001189 on the CI Feed|] has
the update - let us know if that fixes the problem.
We'd appreciate a pull request to update the [Powershell build script|]
so it works on Xamarin.iOS, Xamarin.Android, and UWP, and then we can set it up in TeamCity
to continually test these platforms and help us track down issues (if you have the time, we
should also do Mono and Xamarin.Mac). Unfortunately, I don't currently have access to all
of these platforms nor the space that would be required to virtualize/emulate them in order
to ensure the script works, and doing it all on the TeamCity server would be slow going.

The test task begins [here|]
- we would need an update to that and might need to update the tasks to install platforms,
if required (we had to do that for dotnet core because the TeamCity servers don't necessarily
have the version we need installed and end users might not, as well).

To test, the {{build/build.ps1}} script is run with the following command from TeamCity:
Import-Module .\build\psake.psm1; Invoke-Psake .\build\build.ps1 -Task Test -properties @{frameworks_to_test='netcoreapp2.0';backup_files='false';prepareForBuild='false'}
To build, pack and then test (which we use from the command line), the command looks like:
Import-Module .\build\psake.psm1; Invoke-Psake .\build\build.ps1 Default,Test -properties
@{configuration='Release'} -parameters @{ packageVersion='4.8.0-beta00006';version='0.0.0'
We are using PSake as a task manager, and the documentation for it is [here|].

Also, we currently only have a {{build.bat}} file to launch the command manually, which needs
to be translated into a {{}} to run cross-platform. Note that TeamCity does not use
this file, it is only for end users who want to build/test. Also note this file is [automatically
re-generated during a release|]
by the PSake script so the user only needs to type "build" on the command line and the version
of the current release will be baked in - we would want to do that for a {{}} file,

> Error using Lucene.Net.Facet 4.8.0-beta00005  with Xamarin.iOS
> --------------------------------------------------------------
>                 Key: LUCENENET-602
>                 URL:
>             Project: Lucene.Net
>          Issue Type: Bug
>          Components: Lucene.Net.Facet
>    Affects Versions: Lucene.Net 4.8.0
>         Environment: Xamarin Forms
> Ios 10.3.3 and Higher
> Lucene.Net.Facet 4.8.0-beta00005
>            Reporter: Enrico Caltran
>            Priority: Blocker
>              Labels: AOT, Xamarin.iOS,
>             Fix For: Lucene.Net 4.8.0
>   Original Estimate: 120h
>  Remaining Estimate: 120h
> I'm using Lucene.Net.Facet 4.8.0-beta00005 in a big Xamarin project.
> +With Xamarin.Android and Xamarin.UWP it's all right.+
> *+But With Xamarin.iOS on device (Ipad)+*, i'm receiving this error:
>  _Attempting to JIT compile method 'Lucene.Net.Support.LurchTable2&lt;Lucene.Net.Facet.Taxonomy.FacetLabel,
Lucene.Net.Facet.Taxonomy.Directory.DirectoryTaxonomyReader/Int32Class>> (int,Lucene.Net.Facet.Taxonomy.FacetLabel,int&,Lucene.Net.Support.LurchTable`2/Add2Info<Lucene.Net.Facet.Taxonomy.FacetLabel,
Lucene.Net.Facet.Taxonomy.Directory.DirectoryTaxonomyReader/Int32Class>&)' while running
in aot-only mode. See []
for more information._
> _{color:#d04437}at Lucene.Net.Support.LurchTable2[TKey,TValue].Insert[T] (TKey key, T&amp;
value) &lt;0x2570f48 + 0x000e0&gt; in &lt;063e095c95d945a4ace32ab83d1227eb#2ae0fea9ea4eacaef83bf2e9713bb8ea&gt;:0
at (wrapper unknown) System.Object.gsharedvt_in() at Lucene.Net.Support.LurchTable2[TKey,TValue].AddOrUpdate
(TKey key, TValue addValue, Lucene.Net.Support.KeyValueUpdate2[TKey,TValue] fnUpdate) &lt;0x232824c
+ 0x0013b&gt; in &lt;063e095c95d945a4ace32ab83d1227eb#2ae0fea9ea4eacaef83bf2e9713bb8ea&gt;:0
at Lucene.Net.Facet.Taxonomy.LRUHashMap2[TKey,TValue].Put (TKey key, TValue value) <0x2c487f8
+ 0x0015b> in <79d3a7b905954d0993025c09c5d087ce#2ae0fea9ea4eacaef83bf2e9713bb8ea>:0
at Lucene.Net.Facet.Taxonomy.Directory.DirectoryTaxonomyReader.GetOrdinal (Lucene.Net.Facet.Taxonomy.FacetLabel
cp) <0x2c51970 + 0x0019b> in <79d3a7b905954d0993025c09c5d087ce#2ae0fea9ea4eacaef83bf2e9713bb8ea>:0
at Lucene.Net.Facet.Taxonomy.Int32TaxonomyFacets.GetTopChildren{color} (System.Int32 topN,
System.String dim, System.String[] path) <0x2c481dc + 0x0008f> in <79d3a7b905954d0993025c09c5d087ce#2ae0fea9ea4eacaef83bf2e9713bb8ea>:0
at Login.MyMB.Lucene.Client.LuceneArticoliSearcher.GetListaArticoloXRicercaAvanzataConRicercaSemplice
(System.Collections.Generic.List1[T] listParametri) &lt;0x224add0 + 0x001bb&gt; in
&lt;8f49891e0f0546e185aba7424d294ef7#2ae0fea9ea4eacaef83bf2e9713bb8ea&gt;:0 at Login.MyMB.Lucene.Client.LuceneArticoliSearcher.GetListaArticoloConRicercaSemplice
(System.Collections.Generic.List1[T] listParametri) <0x224afbc + 0x0009f> in <8f49891e0f0546e185aba7424d294ef7#2ae0fea9ea4eacaef83bf2e9713bb8ea>:0
at MyMB.Forms.RicercaLucene.RicercaArticoloLucene.GetListaArticoliXRicercaSemplice (Login.MyMB.Interface.IAmbiente
ambiente, Login.MyMB.Lucene.Client.LuceneArticoliSearcher las, System.Collections.Generic.List`1[T]
ListParametri, System.Boolean isAbilitataRicercaBarcode) <0xe47fc0 + 0x000e7> in <f1bb3149abe145459612794f1a096634#2ae0fea9ea4eacaef83bf2e9713bb8ea>:0
> At the link [] , I
found the problem cause (I suppose...):
> _Value types as Dictionary Keys Using a value type as a Dictionary<TKey, TValue>
key is problematic, as the default Dictionary constructor attempts to use EqualityComparer<TKey>.Default.
EqualityComparer<TKey>.Default, in turn, attempts to use Reflection to instantiate a
new type which implements the IEqualityComparer<TKey> interface. This works for reference
types (as the reflection+create a new type step is skipped), but for value types it crashes
and burns rather quickly once you attempt to use it on the device. Workaround: Manually implement
the IEqualityComparer<TKey> interface in a new type and provide an instance of that
type to the Dictionary<TKey, TValue> (IEqualityComparer<TKey>) constructor._
> So, what can I do? Thank you in advance, Enrico Caltran +393357485560 [|]

This message was sent by Atlassian JIRA

View raw message