sergey-tihon / Stanford.NLP.NET

Stanford NLP for .NET
http://sergey-tihon.github.io/Stanford.NLP.NET/
MIT License
598 stars 123 forks source link

StackOverflow when running C# samples #15

Closed altinoren closed 9 years ago

altinoren commented 9 years ago

Hi,

I'm getting the following error when running the Parser's sample C# code from the site [1]: An unhandled exception of type 'System.StackOverflowException' occurred in IKVM.OpenJDK.Core.dll on line: var gs = gsf.newGrammaticalStructure(tree2); It's all good up to that point.

CoreNLP sample in C# also fails with StackOverflow exception on the following line if annotators include "parse": pipeline.annotate(annotation); // With this, it works: props.setProperty("annotators", "tokenize, ssplit, pos, lemma, ner");

Tests in F# are running fine. I'm using the same CoreNLP library downloaded under "\paket-files\nlp.stanford.edu\stanford-corenlp-full-2015-01-30\models\" through build.cmd.

I couldn't be able to identify any differences between C# sample and F# tests so I'm quite stuck figuring what's going on. Any help would be appreciated.

Thanks.

[1] http://sergey-tihon.github.io/Stanford.NLP.NET/StanfordParser.html

sergey-tihon commented 9 years ago

@altinoren Do you run code equal to samples from site? (without any changes) @volhav Could you assist here?

sergey-tihon commented 9 years ago

C# sample for Stanford Parser works on my machine - https://github.com/sergey-tihon/Stanford.NLP.NET/commit/549a59c86beca7ac0d5dfb29f1d780bd0fc5ffc2

volhav commented 9 years ago

@altinoren I've run both samples as well and they work fine on my machine. Could you please check that you have latest package version from Nuget? If so, could you show your console output? Not only error I mean. Probably it'll help us understand what is going wrong

altinoren commented 9 years ago

My report above is correct but apparently missing some details.

I was testing it in an ASP.NET MVC application. After you request console output, I tested the code in a console application and all works fine (I should have done this in the first place, sorry. I wasn't expecting such a difference based on the platform.). On MVC, not only it raises the error but also considerably slow, there must be some other factors based on the environment.

I'll test some more with a fully deployed IIS scenario and let you know.

sergey-tihon commented 9 years ago

It is strange because I use it under IIS for years. It worked under .NET 3.5 and .NET 4.5 for me.

altinoren commented 9 years ago

IKVM.Net breaks when hosted on IIS Express (on 4.5 Framework, run directly from Visual Studio), and all works well when deployed to IIS. I won't devote more time investigating further since I'll work with Stanford.NLP.NET on IIS for my actual project.

If I have time to test it on a machine other than mine, and if the problem continues, I'll report it to IKVM.Net project.

Thank you all for your time.

boriskozlov commented 9 years ago

Thanks for solving the problem. Indeed, IKVM can't work with IIS express and works perfectly on IIS.

sergey-tihon commented 9 years ago

Do you understand why it does not work under IIS Express?

boriskozlov commented 9 years ago

No idea :)