Issue: with getting the IDomType

SyntaxEditor for Windows Forms Forum

Posted 16 years ago by Hu Xuenian
Version: 4.0.0277
Platform: .NET 2.0
Environment: Windows XP (32-bit)
Avatar
Hi

In the ActiPro example inside the DotNetReflectionForm I have created a button. Here it adds the ColorButton.cs as a file load, using
following statement
dotNetProjectResolver.SourceProjectContent.LoadForFile(cSharpLanguage, Program.ProjectPath + @"ColorButton.cs");


After this, I execute the button click
private void button1_Click(object sender, EventArgs e)
{
IDomType type = dotNetProjectResolver.GetType(null, "TestApplication.ColorButton", DomBindingFlags.AllAccessTypes);

/// I am getting "type" is null here
return;
}

I am unable to get the IDomType. Is there anything wrong in here?

We have the simillar situation in our project where user adds the type/dynamic type using the syntaxeditor of Actipro. since user can type anything I want to validate it against DotNetProjectResolver. but it fails.

is it a bug ? please clarify if you have another ways.

thanks
Paresh

Comments (4)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Paresh,

I think the problem here is that the semantic parser service works on a worker thread. This means that although you request to load the file, it will not immediately be parsed and the IDomType won't be available yet. If you would try it a second or so later, it probably will return ok.


Actipro Software Support

Posted 16 years ago by Hu Xuenian
Avatar
Hi

Thanks for your reply.

I tested with your sample, -

"C:\Program Files\Actipro Software\WindowsForms\SyntaxEditor\v4.0.0276\TestApplication-CSharp.Net20\QuickStart\DotNetReflectionForm.cs"

I added a Button on the form. On the click I added following code.

private void button1_Click(object sender, EventArgs e)
{
bool busy = SemanticParserService.IsBusy;
bool running = SemanticParserService.IsRunning;
IDomType type =
dotNetProjectResolver.GetType(null,
"TestApplication.ColorButton",
DomBindingFlags.AllAccessTypes | DomBindingFlags.ContextIsDeclaringType
);
return; // put a break point here
}

I got following data while doing testing,-

busy=false
running=true
type=null ??? which is what my question is.

I am unable to get a type from dotnetprojectresolver,
Please help with this issue or point some alternative for getting the type.


thanks
Paresh
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Paresh,

Change it to this call:
IDomType type = dotNetProjectResolver.GetType(null, null, "TestApplication.ColorButton", DomBindingFlags.Default);
The overload you called requires a DotNetContext. If you pass null, it will fail. However the other overload allows nulls for the context type and imported namespaces and that will return the IDomType.


Actipro Software Support

Posted 16 years ago by Hu Xuenian
Avatar
thanks & cheers !
The latest build of this product (v24.1.1) was released 29 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.