In this topic you will learn how to execute your code while in Edit and Continue mode in Visual Studio Express, while GN4 application is running (it was launched in the previous step Edit and Continue: select project to debug and launch GN4 application).
Here we will use the built-in script editor to run our test code.
Important: GN4 methods are context dependent, and it means they're are available only in appropriate context. As in this example we created a method in CustomArticle, the appropriate context to test it is while editing some text. See Add-ins and context for more information.
As in the first step, explained in Edit and Continue: preparing your method and adding breakpoint, we started to edit CustomArticle.vb, and created a method MyTest, it means we can test it only while editing some text.
1.Create a new article or open an existing one, open an element for editing, and then display Script editor (Window > Palettes > Script editor). 2.Type MyTest in the upper box, under Command, and make sure the Context is TxtDesigner (CustomTxtDesignerAddIn). 1.Click Execute. Visual Studio Express pops in foreground, with the breakpoint highlighted: At this point, the application is stopped and locked (if you ALT+Tab to it, you will see it as "not responding", but it's not a fault, it's normal). The breakpoint is highlighted in yellow color. You have several choices: •You can press F5 again, and the application will execute the line at the breakpoint, and then proceed to execute the rest of the code (up to the next breakpoint, but as you set only one, there will be no "next breakpoint" at this time). For this example, we pressed F5, thus Ted4 was unlocked (the breakpoint turned to red), and the message box was displayed. Clicking OK, the second message box is displayed, and Ted4 goes idle. •You can press F8, or F10 and the application will execute the next line, and then stop again (use this to execute line-by-line). •You can edit the code (note that you can edit it only when the breakpoint is active, ie. highlighted in yellow). Then, press F5, F8 or F10 and it will execute the modified code: •The last choice is that you can stop debugging (Debug > Stop debugging) - that will shutdown GN4 application you are debugging, and return control to Visual Studio Express. But, before you do this, close all documents you opened in the GN4 application and prepare it for the clean exit - otherwise, documents remain locked. |