Shad,
I'd like to share some information of my recent investigation with you:
1. First it crashed at assembly.GetTypes() in the function ScanForCodecs():
foreach (var c in assembly.GetTypes())
To resolve this issue I built up a list of the CodecNames manually, got their
types and put them into "PutCodecTypeImpl()"
Btw. Do you need to search through all the system assemblies (list of > 4000
elements)? Can't we just search for the attributes e.g.
"[CodecName("Lucene46")]"?
2. Then it instantiated the Lucene46Codec but crashed at:
"PostingsFormat defaultFormat = Codecs.PostingsFormat.ForName("Lucene41");"
I think the crash originated from "ScanForPostingsFormats()" which has a very
smiliar structure to the ScanForCodecs() function and also uses
assembly.GetTypes().
So I guess I have to rewrite this function as well. Same for the DocValues...
In general, reflection is working in partial trust mode, but not completely it
seems. I'm not sure about what is/isn't working exactly.
Best Regards,
Matthias
-----Original Message-----
From: Shad Storhaug [mailto:[email protected]]
Sent: Mittwoch, 17. Mai 2017 11:37
To: [email protected]; [email protected]
Subject: RE: Problems when running a search in my production environment
Matthias,
There could be a couple of things happening here. The DefaultCodecFactory uses
reflection first to get a list of all of the codecs, then it uses it again to
instantiate the requested codec.
To narrow it down, is the list at Codec.AvailableCodecs() populated with codecs
or not? Could you post the values that you see there?
Thanks,
Shad Storhaug (NightOwl888)
-----Original Message-----
From: Matthias Strauss - xRM1 Business Solutions
[mailto:[email protected]]
Sent: Wednesday, May 17, 2017 4:21 PM
To: [email protected]
Cc: [email protected]
Subject: RE: Problems when running a search in my production environment
Hey Itamar,
I'm still fighting with it. I got it to work in non-sandboxed mode by changing
the following line in AttributeSource.cs from
string name = attClass.FullName.Replace(attClass.Name,
attClass.Name.Substring(1)) + ", " + attClass.GetTypeInfo().Assembly.FullName;
to
string name = attClass.FullName.Replace(attClass.Name,
attClass.Name.Substring(1));
My simple search is working now, but not in sandboxed (partial trust) mode.
There it fails to get the default Codec when initializing the IndexWriter.
Do you have any ideas?
Best Regards,
Matthias
-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Itamar Syn-Hershko
Sent: Montag, 15. Mai 2017 17:45
To: [email protected]
Subject: Re: Problems when running a search in my production environment
Does this work on production for you without ILMerging? if yes, then that'd be
the problem
--
Itamar Syn-Hershko
Freelance Developer & Consultant
Elasticsearch Partner
Microsoft MVP | Lucene.NET PMC
http://code972.com | @synhershko <https://twitter.com/synhershko>
http://BigDataBoutique.co.il/
On Mon, May 15, 2017 at 6:43 PM, Matthias Strauss - xRM1 Business Solutions
<[email protected]> wrote:
> 1. "Could not instantiate implementing class for Lucene.Net.Analysis.
> TokenAttributes.ICharTermAttribute"
>
> For Sandbox mode:
> 2. "The type initializer for 'Lucene.Net.Codecs.Codec' threw an
> exception." at Lucene.Net.Codecs.Codec.get_Default()
> "Unable to load one or more of the requested types. Retrieve
> the LoaderExceptions property for more information."
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> On Behalf Of Itamar Syn-Hershko
> Sent: Montag, 15. Mai 2017 17:20
> To: [email protected]
> Subject: Re: Problems when running a search in my production
> environment
>
> What is the exact exception(s) ?
>
> --
>
> Itamar Syn-Hershko
> Freelance Developer & Consultant
> Elasticsearch Partner
> Microsoft MVP | Lucene.NET PMC
> http://code972.com | @synhershko <https://twitter.com/synhershko>
> http://BigDataBoutique.co.il/
>
> On Mon, May 15, 2017 at 6:02 PM, Matthias Strauss - xRM1 Business
> Solutions <[email protected]> wrote:
>
> > Hey guys,
> >
> > I'm not sure if this is a thing for the user or dev mailing list,
> > but
> I've
> > got a problem running a basic search in my production environment (CRM).
> >
> >
> > 1. When adding a simple document to my IndexWriter I will get a
> > runtime error in the following location:
> > Lucene.Net\Util\AttributeSource.cs
> > internal static Type GetClassForInterface<T>() where T : IAttribute
> > It crashes at: "attClass.GetTypeInfo()"
> >
> > So I think this method is a feature of mscorlib.dll, but why is it
> > crashing on my server and not on my local machine?
> >
> >
> > 2. When running the code in sandbox mode (partially trusted code)
> my
> > sample app crashes even earlier when initializing the IndexWriter
> > (with
> > RamDirectory) at:
> > Lucene.Net\Index\LiveIndexWriterConfig.cs
> > internal
> > LiveIndexWriterConfig(Analyzer analyzer, LuceneVersion matchVersion)
> > Exception: "Unable to load one or more of the requested types.
> > Retrieve the LoaderExceptions property for more information." at
> > source
> "mscorlib".
> >
> > Locally the code is working fine.
> > I'm merging my code with ILMerge. Could this be the cause of the problem?
> > When I merge the 4 basic Lucene.Net dll's into a single one, it's
> > still working fine locally.
> >
>