Distribution of ActiproSoftware.Text.Addons.DotNet.Net20

SyntaxEditor for WPF Forum

Posted 10 years ago by Joseph Feser
Avatar
I am using the CShart and VbNet syntax classes for the syntax editor as see here.

private static ISyntaxLanguage LANG_CS = (ISyntaxLanguage)new CSharpSyntaxLanguage();
private static ISyntaxLanguage LANG_VB = (ISyntaxLanguage)new VBSyntaxLanguage();

The Deployment page in the help states not to destribute ActiproSoftware.Text.Addons.DotNet.Net20 but it is required. Is there a bug in the page or is there a workaround?

C:\xxx\SourceCodeViewer\ActiproCodeHighlighter.xaml.cs(31,26): error CS0012: The type 'ActiproSoftware.Text.Languages.CSharp.CSharpSyntaxLanguageBase' is defined in an assembly that is not referenced. You must add a reference to assembly 'ActiproSoftware.Text.Addons.DotNet.Net20, Version=9.1.505.0, Culture=neutral, PublicKeyToken=36ff2196ab5654b9'.
c:\xxx\ActiproSoftware.SyntaxEditor.Addons.DotNet.Wpf30.dll: (Related file)
C:\xxx\ActiproCodeHighlighter.xaml.cs(31,26): error CS0012: The type 'ActiproSoftware.Text.Languages.VB.VBSyntaxLanguageBase' is defined in an assembly that is not referenced. You must add a reference to assembly 'ActiproSoftware.Text.Addons.DotNet.Net20, Version=9.1.505.0, Culture=neutral, PublicKeyToken=36ff2196ab5654b9'.
c:\xxx\ActiproSoftware.SyntaxEditor.Addons.DotNet.Wpf30.dll: (Related file)

Joe Feser

Comments (9)

Posted 10 years ago by Joseph Feser
Avatar
I tried changing to using a dynamic lexer

/// <summary>
/// Initializes a new instance of the <c>CSharpDynamicSyntaxLanguage</c> class.
/// </summary>
public CSharpDynamicSyntaxLanguage() : base("C#") {
// Load lexer from resource stream
string path = "xxx.Languages.Lexers." + "ActiproSoftware.CSharp.xml";
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(path)) {
// TODO: This loading API will likely change in the near future
this.RegisterService(DynamicLexer.LoadFromXml(stream, 0));

// Set the classifier factory
this.RegisterService(new TokenClassifierFactory(typeof(MergableLexerClassifier)));

}
}

and then assigning the document language like I was before but nothing is highlighted.

I am not able to find anything in the documentation to work around the issue.

Thank you,

Joe Feser
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Joe,

If you are going to use the C#/VB add-on languages, you'd need these two assemblies:
ActiproSoftware.SyntaxEditor.Addons.DotNet.Wpf30.dll
ActiproSoftware.Text.Addons.DotNet.Net20.dll

Now keep in mind those are very early work in progress assemblies that are for our advanced C#/VB implementations, which will eventually have functionality like our WinForms .NET Languages Add-on has. These assemblies, once developed some more, will also not be free and will be sold separately as an optional add-on, the same way they are for the WinForms version of SyntaxEditor.

So while you can use them for now, please keep in mind that future versions at some point will no longer be free. They will be kept cheap though. For instance our WinForms .NET Languages Add-on is $199.95 for an Enterprise license that covers all developers who are licensed to use SyntaxEditor. We don't sell them yet for WPF since they really only have lexing capabilities right now.


Actipro Software Support

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
The "dynamic" lexer version of C# will always be free. If you want to use that you need to make sure that "ActiproSoftware.CSharp.xml" file is accessible. That sample loads it assuming it's an Embedded Resource in your application with the specified path. You can use another overload of DynamicLexer.LoadFromXml that loads from a file, which may be easier for you.

We are currently working on finalizing the language definition format for WPF (in the version you have it is temporarily using the old WinForms format) and are updating the Language Designer to work with the new format and convert from the WinForms format to the new format. These features are what we hope to get in the next build. We'll also be working on more lexer documentation since a lot is missing right now due to things being temporary until the version we're working on is done.


Actipro Software Support

Posted 10 years ago by Joseph Feser
Avatar
It does find the resouce and the object is correct, but as I mentioned in my last post, it does not highlight the code.

It worked fine when I used the original sample.

I set the document language = the instance of the dynamic lexar class.

Do you need a code sample to see it not working?

Joe Feser
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Yes, please make a simple sample project that shows the issue and email it to our support address. Thanks.


Actipro Software Support

Posted 10 years ago by Joseph Feser
Avatar
Sent

1C2-124E4F71-A53E
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
In your sample, you didn't register the services using the proper service types. So they weren't able to be located. Do this and it works:
this.RegisterService<ActiproSoftware.Text.Lexing.ILexer>(DynamicLexer.LoadFromXml(stream, 0));
this.RegisterService<ActiproSoftware.Text.Classification.ITokenClassifierFactory>(new TokenClassifierFactory(typeof(MergableLexerClassifier)));


Actipro Software Support

Posted 10 years ago by Joseph Feser
Avatar
That works.

I tried to follow the sample, which doesn't work.

Thanks

Joe Feser
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
The sample works fine but it uses extension methods like RegisterLexer which do RegisterService<ILexer>, etc. Your sample changed the code to RegisterService but didn't specify the service type, which was the problem. The documentation talks about which service types can be registered if you don't use the extension methods we provided. That will help you in the future.

As a side note, we can't include the extension methods directly in the product yet because our code targets .NET 3.0 and extension methods were added for .NET 3.5.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.