LoadFromCode && SemanticParserService.IsBusy

SyntaxEditor .NET Languages Add-on for Windows Forms Forum

Posted 17 years ago by Erik Pepping - RADVenture B.V
Version: 4.0.0262
Platform: .NET 2.0
Environment: Windows XP (32-bit)
I think there might be a problem (lock/thread) with IsBusy since it's not return TRUE after calling LoadForCode.

Note: When using LoadForCode we don't get a SemanticParserServiceRequest so we can't use SemanticParserService.WaitForParse( parseHashKey).

public void LoadFrom(string pSourceCode)
            if (string.IsNullOrEmpty(pSourceCode)) throw new ArgumentNullException("pSourceCode");

            DotNetProjectResolver resolver = CreateDotNetProjectResolver();
            if (resolver == null) throw new Exception("Project resolver could not be created");

            resolver.SourceProjectContent.LoadForCode(new CSharpSyntaxLanguage(), "test", pSourceCode);

            while (SemanticParserService.IsBusy || SemanticParserService.PendingRequestCount >0)

            ICollection types = resolver.SourceProjectContent.GetTypesForSourceKey("test",false);
            if (types == null || types.Count == 0)
                if (SemanticParserService.IsBusy)
                    throw new Exception("How can it be now busy??");

                throw new Exception("Load Failed");
As you can image I am getting the exception "How can it be now busy?" and , IMHO makes no sense... Is there another way to wait?

NOTE (Extra information) : It seems that it does not happen so easily in real double core processor (or maybe it's just faster and then it's not so easily to notice). The fact is that the same tests behaves differently according to the machine.

[Modified at 11/23/2007 06:43 AM]

Comments (2)

Posted 17 years ago by Erik Pepping - RADVenture B.V
Any news about this point?
If you need I can create a standalone test project that helps reproducing it...
Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Erik,

Sorry, for some reason I don't think we ever got the forum post notification for your original message. Perhaps it was filtered off by our email server for some reason.

Anyhow, since the service is operating in a separate thread, it may not have woken up yet when your first loop is reached in your case. When I ran your code here it got stuck in your first loop. I've looked into that and part of the issue is that when the semantic parser service completes, it has to call back to the Document (via an invoke), which needs to run but your code is looping, preventing the Document call from completing. Therefore the service is still busy because it is in a wait state.

If you'd like to discuss all this in more detail, feel free to email us. One thing you probably will have to do is use a timer or some other method to allow main thread code to process without being in a loop or sleep.

Also we'd love to talk over ideas for future changes in this area since we will probably start designing some major new features in the coming weeks.

Actipro Software Support

The latest build of this product (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.