Get Syntax Language v4.0.40

CodeHighlighter for ASP.NET Forum

Posted 17 years ago by Todd Richardson
Version: 4.0.40
Avatar
I am creating a Asp.Net HTTP Module that will use the CodeHighlighter dynamically without the use of the the ASP.Net form control.
I have added a reference to the following dll's and copied the assemblies to my websites bin directory:

ActiproSoftware.CodeHighlighter.Net20.dll v4.0.40.0
ActiproSoftware.Shared.Net20.dll v1.0.83.0

I then use the following code:
Dim configuration As CodeHighlighterConfiguration = CType(System.Configuration.ConfigurationManager.GetSection("codeHighlighter"), CodeHighlighterConfiguration)
Dim language As ActiproSoftware.SyntaxEditor.SyntaxLanguage = ActiproSoftware.CodeHighlighter.CodeHighlighter.GetLanguage(configuration, Options.LanguageName)
When executing the GetLanguage Function I receive the following error:
ActiproSoftware.SyntaxEditor.InvalidLanguageDefinitionException was unhandled by user code
  Message="An error occurred while loading the DynamicSyntaxLanguage '{Unknown}':
The syntax language type 'CodeHighlighterTest.VBDotNetDynamicSyntaxLanguage, CodeHighlighterTest' could not be loaded.
The problem occurred near line 1, position 2
in Unknown Stream."
  Source="ActiproSoftware.CodeHighlighter.Net20"
  StackTrace:
       at l.a(DynamicSyntaxLanguage A_0, XmlTextReader A_1, String A_2, Boolean A_3)
       at l.b(DynamicSyntaxLanguage A_0, XmlTextReader A_1, String A_2)
       at l.a(IDesignerHost A_0, XmlTextReader A_1, String A_2, DynamicSyntaxLanguage A_3)
       at l.b(IDesignerHost A_0, XmlTextReader A_1, String A_2, DynamicSyntaxLanguage A_3)
       at l.c(IDesignerHost A_0, XmlTextReader A_1, String A_2, DynamicSyntaxLanguage A_3)
       at ActiproSoftware.SyntaxEditor.Addons.Dynamic.DynamicSyntaxLanguage.a(IDesignerHost A_0, Stream A_1, Int32 A_2, DynamicSyntaxLanguage A_3)
       at ActiproSoftware.SyntaxEditor.Addons.Dynamic.DynamicSyntaxLanguage.LoadFromXml(String path, Int32 encryptionKey)
       at ActiproSoftware.CodeHighlighter.CodeHighlighter.GetLanguage(CodeHighlighterConfiguration config, String languageKey)
       at HttpModules.CodeHighlighter.HighlightCode(String inputText, CodeBlockOptions Options) in D:\My Documents\Visual Studio 2005\Projects\HttpModules.CodeHighlighter.Net20\CodeHighlighter.vb:line 125
       at HttpModules.CodeHighlighter.Write(Byte[] buffer, Int32 offset, Int32 count) in D:\My Documents\Visual Studio 2005\Projects\HttpModules.CodeHighlighter.Net20\CodeHighlighter.vb:line 104
       at System.Web.HttpWriter.Filter(Boolean finalFiltering)
       at System.Web.HttpResponse.FilterOutput()
       at System.Web.HttpApplication.CallFilterExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
I am able to resolve this error by adding a reference to the CodeHighlighterTest.dll that is created with the samples you have provided. I have no idea why this dll would need to be added to my project for the GetLanguage function to work. Is there some kind of work around, as it seems like it should be unnecesary to include the CodeHighlighterTest.dll in my project.

Thanks for any help you may be able to provide.

Comments (2)

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Yes the code-behind classes for some of the XML definitions have their source in the
CodeHighlighterTest assembly. Classes like VBDotNetDynamicSyntaxLanguage provide
outlining support. If you look at the related XML definition, you'll see an attribute
in the root tag that specifies the type and assembly location of the code-behind language.

You should simply copy the code-behind class to your own assembly and change the
type/assembly name references in the XML definition to point to your namespace and
assembly where you placed the code-behind class. Then all is good.


Actipro Software Support

Posted 17 years ago by Todd Richardson
Avatar
Once I added the language .vb files to my assembly, compiled and modified the xml files to point to my assembly, everything worked perfectly without adding the reference to CodeHighlighterTest.dll.
Thank you for your help!
The latest build of this product (v4.0.59) was released 13 years ago, which was after the last post in this thread.