Adding a reference after setting text can lead to warnings / red squiggles in the editor

I set up a csParser, set it to the csTextSource, set that to the syntaxEdit.
Now if I set the syntaxEdit.Text before adding the references csParser.Repository.AddFileReference, then on occasion I get the red squiggle lines under the types that depend on those references.
I have tried csParser.ReparseText();, but that didn't work.
syntaxEdit.Text = syntaxEdit.Text seems to do the trick.
Is this what is expected, or is there another method out there that I should be using?
Hello Rob,
ReparseText should invalidate syntax errors in the editor, please refer to the sample project that I've uploaded here:
https://www.alternetsoft.com/forum/AddFileReferenceTest.zip
If it does not work at your end, could you please send us cut-down version of your project so we can take a look?
Regards,
Andrew
Instead of the buttons, if you set text, add reference, reparse and then show the control. (e.g. constructor / load event) it seems to not re parse.
Hello Rob,
Thank you for reporting this problem, we have reproduced it and will fix it in the next update.
As a workaround you just need to initialize Roslyn Workspace before adding file reference like this:
var workspace = csParser1.Repository.Solution.Workspace;
csParser1.Repository.AddFileReference(@"..\Debug\ClassLibrary.dll");
csParser1.ReparseText();
Let me know if it helps.
Regards,
Andrew
That did the trick! Thanks