microsoft / BlingFire

A lightning fast Finite State machine and REgular expression manipulation library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Calling LoadModel from .net core WebAPI throws SEHException

gluckez opened this issue · comments

exception:
at BlingFire.BlingFireUtils.LoadModel(Byte[] modelName) at BlingFire.BlingFireUtils.LoadModel(String modelName) in C:\Users\vanac\.nuget\packages\blingfirenuget\0.1.4\contentFiles\cs\any\BlingFireUtils.cs:line 23

The same code was tested with unit tests and works perfectly. It only throws the exception when i send a request to a webAPI using the same component. (this behaviour is the same for running the api through IIS as well as running it directly.)

EDIT: code causing this issue:
public TextTokenizer() { _EncoderModel = BlingFireUtils.LoadModel("./bert_base_tok.bin"); }

Update: The fault was mine. when running in a webApi, the application runs in a workingdirectory different from where the assembly is located, which caused it to not find the file, but the exception didn't really tell me much. I consider this closed.

There was a long lasting feature request, that API should not throw the exception and rather return an error code. My apologies it is still not done... if you want feel free to take on this task :-) though.