This article contains an overview of Visual Studio Automation Object Model. Model's overall structure and the means of obtaining access to its interfaces through DTE/DTE2 top level objects are examined. Several examples of utilizing elements of the model are provided. Also discussed are the issues of using model's interfaces within multithreaded applications; an example of implementing such mechanism for multithreaded interaction with COM interfaces in managed code is provided as well.
Creating, debugging and deploying extension packages for Microsoft Visual Stu...PVS-Studio
This article contains the overview of several different methods for extending Visual Studio IDE. The creation, debugging, registration and end-user deployment of Visual Studio extension packages will be explained in detail.
- Perspectives in Eclipse workbench are visual containers that group related views and editors to accomplish a specific task.
- Creating a perspective involves defining an extension in plugin.xml and implementing the perspective class to control initial layout.
- Views display data from the domain model and are created by defining an extension point and implementing the view class.
- The entry point for an RCP application is a class that implements IApplication to control application execution and create the workbench.
Building non-blocking JavaFX 8 applications with JacpFX [CON1823]Andy Moncsek
Event bus, message passing, and async execution are concepts that are getting more and more popular for server-side applications. JacpFX brings this approach to the client, combining JavaFX with an actorlike component model. It is an UI application framework based on JavaFX, supporting developers in structuring applications with loosely coupled, reusable components. It frees you from the pitfalls of traditional multithreaded programming, helping you separate the task execution from UI changes in your client application. Furthermore, this component model works well with common communication technologies such as WebSocket, SSE, and JMS.
This document provides an overview of creating a basic Eclipse Rich Client Platform (RCP) application, including setting up the necessary plug-in project, defining perspectives and views, and implementing core classes like Application, WorkbenchAdvisor, and Perspective. It describes how to add new views to a perspective and launch the RCP application. The key classes involved in startup and initialization of the Eclipse workbench are also explained.
This document provides an overview of programming graphical user interfaces (GUIs) in Java using the Abstract Window Toolkit (AWT) and Swing APIs. It discusses AWT containers like Frame, Panel, and Dialog which are used to hold components in layouts. Common AWT components include buttons, labels, text fields. It also covers key concepts like events, listeners and layout managers for positioning components. The document is an introduction to building GUIs in Java using the standard classes and APIs.
The document discusses various Swing components in Java including labels, buttons, text fields, checkboxes, radio buttons, scroll panes, tabbed panes, and combo boxes. It provides the classes, constructors, and methods used to implement each component as well as examples of code to create and add the components to an applet container.
Creating, debugging and deploying extension packages for Microsoft Visual Stu...PVS-Studio
This article contains the overview of several different methods for extending Visual Studio IDE. The creation, debugging, registration and end-user deployment of Visual Studio extension packages will be explained in detail.
- Perspectives in Eclipse workbench are visual containers that group related views and editors to accomplish a specific task.
- Creating a perspective involves defining an extension in plugin.xml and implementing the perspective class to control initial layout.
- Views display data from the domain model and are created by defining an extension point and implementing the view class.
- The entry point for an RCP application is a class that implements IApplication to control application execution and create the workbench.
Building non-blocking JavaFX 8 applications with JacpFX [CON1823]Andy Moncsek
Event bus, message passing, and async execution are concepts that are getting more and more popular for server-side applications. JacpFX brings this approach to the client, combining JavaFX with an actorlike component model. It is an UI application framework based on JavaFX, supporting developers in structuring applications with loosely coupled, reusable components. It frees you from the pitfalls of traditional multithreaded programming, helping you separate the task execution from UI changes in your client application. Furthermore, this component model works well with common communication technologies such as WebSocket, SSE, and JMS.
This document provides an overview of creating a basic Eclipse Rich Client Platform (RCP) application, including setting up the necessary plug-in project, defining perspectives and views, and implementing core classes like Application, WorkbenchAdvisor, and Perspective. It describes how to add new views to a perspective and launch the RCP application. The key classes involved in startup and initialization of the Eclipse workbench are also explained.
This document provides an overview of programming graphical user interfaces (GUIs) in Java using the Abstract Window Toolkit (AWT) and Swing APIs. It discusses AWT containers like Frame, Panel, and Dialog which are used to hold components in layouts. Common AWT components include buttons, labels, text fields. It also covers key concepts like events, listeners and layout managers for positioning components. The document is an introduction to building GUIs in Java using the standard classes and APIs.
The document discusses various Swing components in Java including labels, buttons, text fields, checkboxes, radio buttons, scroll panes, tabbed panes, and combo boxes. It provides the classes, constructors, and methods used to implement each component as well as examples of code to create and add the components to an applet container.
Swing is a GUI widget toolkit for Java. It is part of Oracle's Java Foundation Classes (JFC) – an API for providing a graphical user interface (GUI) for Java programs.
This document provides step by step instructions on how to achieve dependency injection using dagger 2. The code is written in java. The code content is courtesy of Coding In Flow - You can check out this channel for in-depth explanation. https://www.youtube.com/watch?v=ZZ_qek0hGkM&list=PLrnPJCHvNZuA2ioi4soDZKz8euUQnJW65
Java programming, Java Swing Programming, SWING GUI Design, desktop application, Getting Started with Swing application development in java, Introduction to GUI based programming in java, Java to standard edition, J2SE, Core Java, Swing package in java
The document provides an overview of the Abstract Window Toolkit (AWT) classes in Java. It discusses that AWT classes are available in the java.awt package and support creating applet windows and standalone GUI applications. It then lists and describes many important AWT classes, including those for buttons, checkboxes, menus, text fields, labels and more.
This document discusses Java Database Connectivity (JDBC) which is an API used to connect Java applications to databases. It describes the different types of JDBC drivers including bridge, native, network protocol, and thin drivers. It also outlines the basic steps to connect to a database using JDBC including registering the driver, getting a connection, creating statements, executing queries, and closing the connection. Key interfaces like Connection, Statement, PreparedStatement, and ResultSet are also summarized.
The document provides an overview of key Java programming concepts including: the features of Java technology; the primary goals and functions of the Java Virtual Machine and garbage collection; how Java source files are compiled and executed; the three main tasks of the JVM; modeling concepts like abstraction and encapsulation; and how to declare classes, methods, and constructors in Java. It also summarizes how packages, imports, and the Java API documentation work.
The document discusses Java Foundation Classes (JFC) which provide components for building graphical user interfaces in Java. JFC includes Swing components like buttons and menus, pluggable look and feel, accessibility APIs, and drag and drop support. Swing provides standard GUI components and containers to organize components in windows. Top-level containers like JFrame are needed to display components on screen and provide support for painting and events.
Java 8 introduces new type annotation syntax (JSR 308) permitting annotations to appear on any use of a type. Type annotations provide exciting new opportunities for tooling such as detecting additional classes of errors at compile-time. This presentation provides an overview of the new type annotation syntax, tools for leveraging type annotations, and type annotation design patterns.
These slides are from Todd Schiller's talk at the March 24th New York City Java Meetup.
The document discusses Java event handling and GUI components. It defines events as objects that describe user actions, and event handlers as methods that process events from components like buttons. It explains how to create listeners for common event types like action events and mouse clicks, and how to add menus, menu items, and control colors in Java GUI applications.
This document provides information about Java applets, including:
1. An applet is a special type of program that is embedded in a webpage to generate dynamic content and runs at the client side inside a browser.
2. Advantages of applets include running at the client side for less response time, being secured, and being able to execute on multiple platforms via browsers. A drawback is requiring a plugin at the client browser.
3. The document then discusses the applet lifecycle, including initialization, running, idle, and destroyed states, and the methods corresponding to each state. It also provides examples of creating a basic "Hello World" applet and displaying graphics within an applet.
Introduction to Annotations.
What are Annotations➔ Annotations are structured information added to program source code➔ Annotations associated meta-information with definitions➔ They can be attached to any variable, method, expression, or another program element Like comments, they can be sprinkled throughout a program➔ Unlike comments, they have structure, thus making them easier to machine process.
This document provides an overview of key concepts to be covered in a Java programming language session, including:
1. Writing programs that use command-line arguments, system properties, and standard input/output.
2. Creating, reading and writing files.
3. Understanding the basic collections hierarchy and writing programs using sets, lists, and generic collections.
4. Iterating over collections.
This document provides an overview of key Java programming concepts including: identifiers, primitive and reference data types, variables, objects, casting, conditional statements like if/else and switch, and looping statements like for, while, and do-while loops. It describes how to declare variables, construct objects, pass arguments, use this, and control flow with break/continue. The goal is to teach basic Java syntax and programming structures.
A simple presentation that I did at work that goes over Unit Test, Mocking and TDD to improve development, it is explained from a Java perspective but can be helpful to apply TDD to other languages as well.
This document discusses object-oriented programming concepts in C#, including constructors, destructors, polymorphism, function overloading, and operator overloading. Constructors initialize objects, destructors release objects from memory, and polymorphism allows one interface to have multiple implementations. Function overloading uses the same name for functions that differ in parameters, while operator overloading extends operators to user-defined types.
The document provides a tutorial on using Google GIN (GWT INjection) for dependency injection in GWT client-side code. It explains that GIN is built on top of Guice and brings automatic dependency injection to GWT applications. It then outlines the 5 steps to implement GIN: 1) design interfaces, 2) create implementation classes, 3) configure bindings in a module, 4) define a Ginjector interface, and 5) generate and use the Ginjector. The steps are then explained in further detail with examples.
The document provides an overview of object-oriented programming using C#. It discusses the rationale for using an object-oriented approach and describes the key concepts like classes, objects, states, behaviors, and interactions. It also outlines the objectives of learning about features of OOP methodology, defining classes and variables in C#, and writing and executing C# programs. The document uses examples like a car class to illustrate concepts like classes, objects, states and behaviors.
Java annotations provide a way to decorate programs with additional metadata information without directly affecting program semantics. Annotations can be read from source code, class files, or reflectively at runtime. The Java Metadata Facility specification defines how annotations can be declared and used. Annotations allow for more declarative programming by specifying what to do rather than how to do it.
Here are the steps to implement a filter to redirect requests to a maintenance page:
1. Create a class that implements the Filter interface.
2. Add init(), doFilter() and destroy() methods.
3. In doFilter(), get the request URI and check if it is the home page URL.
4. If it is the home page, get the response and send a redirect to the maintenance page.
5. Else, pass the request and response to the filter chain.
6. Map the filter in web.xml, specifying the URL pattern as /* to apply to all requests.
7. Create the maintenance page that displays the message.
8. Deploy and test
The document summarizes the results of analyzing the OpenCV computer vision library with the PVS-Studio code analyzer. Several real bugs were found in older versions of OpenCV and have since been fixed. New analysis of the current OpenCV version uncovered additional bugs, including copy-paste errors, meaningless loops, misprints in conditions, pointer errors, and poor test cases. The analysis demonstrates that static analysis is useful for finding real bugs in large, complex libraries like OpenCV during development.
The article describes the testing technologies used when developing PVS-Studio static code analyzer. The developers of the tool for programmers talk about the principles of testing their own program product which can be interesting for the developers of similar packages for processing text data or source code.
Swing is a GUI widget toolkit for Java. It is part of Oracle's Java Foundation Classes (JFC) – an API for providing a graphical user interface (GUI) for Java programs.
This document provides step by step instructions on how to achieve dependency injection using dagger 2. The code is written in java. The code content is courtesy of Coding In Flow - You can check out this channel for in-depth explanation. https://www.youtube.com/watch?v=ZZ_qek0hGkM&list=PLrnPJCHvNZuA2ioi4soDZKz8euUQnJW65
Java programming, Java Swing Programming, SWING GUI Design, desktop application, Getting Started with Swing application development in java, Introduction to GUI based programming in java, Java to standard edition, J2SE, Core Java, Swing package in java
The document provides an overview of the Abstract Window Toolkit (AWT) classes in Java. It discusses that AWT classes are available in the java.awt package and support creating applet windows and standalone GUI applications. It then lists and describes many important AWT classes, including those for buttons, checkboxes, menus, text fields, labels and more.
This document discusses Java Database Connectivity (JDBC) which is an API used to connect Java applications to databases. It describes the different types of JDBC drivers including bridge, native, network protocol, and thin drivers. It also outlines the basic steps to connect to a database using JDBC including registering the driver, getting a connection, creating statements, executing queries, and closing the connection. Key interfaces like Connection, Statement, PreparedStatement, and ResultSet are also summarized.
The document provides an overview of key Java programming concepts including: the features of Java technology; the primary goals and functions of the Java Virtual Machine and garbage collection; how Java source files are compiled and executed; the three main tasks of the JVM; modeling concepts like abstraction and encapsulation; and how to declare classes, methods, and constructors in Java. It also summarizes how packages, imports, and the Java API documentation work.
The document discusses Java Foundation Classes (JFC) which provide components for building graphical user interfaces in Java. JFC includes Swing components like buttons and menus, pluggable look and feel, accessibility APIs, and drag and drop support. Swing provides standard GUI components and containers to organize components in windows. Top-level containers like JFrame are needed to display components on screen and provide support for painting and events.
Java 8 introduces new type annotation syntax (JSR 308) permitting annotations to appear on any use of a type. Type annotations provide exciting new opportunities for tooling such as detecting additional classes of errors at compile-time. This presentation provides an overview of the new type annotation syntax, tools for leveraging type annotations, and type annotation design patterns.
These slides are from Todd Schiller's talk at the March 24th New York City Java Meetup.
The document discusses Java event handling and GUI components. It defines events as objects that describe user actions, and event handlers as methods that process events from components like buttons. It explains how to create listeners for common event types like action events and mouse clicks, and how to add menus, menu items, and control colors in Java GUI applications.
This document provides information about Java applets, including:
1. An applet is a special type of program that is embedded in a webpage to generate dynamic content and runs at the client side inside a browser.
2. Advantages of applets include running at the client side for less response time, being secured, and being able to execute on multiple platforms via browsers. A drawback is requiring a plugin at the client browser.
3. The document then discusses the applet lifecycle, including initialization, running, idle, and destroyed states, and the methods corresponding to each state. It also provides examples of creating a basic "Hello World" applet and displaying graphics within an applet.
Introduction to Annotations.
What are Annotations➔ Annotations are structured information added to program source code➔ Annotations associated meta-information with definitions➔ They can be attached to any variable, method, expression, or another program element Like comments, they can be sprinkled throughout a program➔ Unlike comments, they have structure, thus making them easier to machine process.
This document provides an overview of key concepts to be covered in a Java programming language session, including:
1. Writing programs that use command-line arguments, system properties, and standard input/output.
2. Creating, reading and writing files.
3. Understanding the basic collections hierarchy and writing programs using sets, lists, and generic collections.
4. Iterating over collections.
This document provides an overview of key Java programming concepts including: identifiers, primitive and reference data types, variables, objects, casting, conditional statements like if/else and switch, and looping statements like for, while, and do-while loops. It describes how to declare variables, construct objects, pass arguments, use this, and control flow with break/continue. The goal is to teach basic Java syntax and programming structures.
A simple presentation that I did at work that goes over Unit Test, Mocking and TDD to improve development, it is explained from a Java perspective but can be helpful to apply TDD to other languages as well.
This document discusses object-oriented programming concepts in C#, including constructors, destructors, polymorphism, function overloading, and operator overloading. Constructors initialize objects, destructors release objects from memory, and polymorphism allows one interface to have multiple implementations. Function overloading uses the same name for functions that differ in parameters, while operator overloading extends operators to user-defined types.
The document provides a tutorial on using Google GIN (GWT INjection) for dependency injection in GWT client-side code. It explains that GIN is built on top of Guice and brings automatic dependency injection to GWT applications. It then outlines the 5 steps to implement GIN: 1) design interfaces, 2) create implementation classes, 3) configure bindings in a module, 4) define a Ginjector interface, and 5) generate and use the Ginjector. The steps are then explained in further detail with examples.
The document provides an overview of object-oriented programming using C#. It discusses the rationale for using an object-oriented approach and describes the key concepts like classes, objects, states, behaviors, and interactions. It also outlines the objectives of learning about features of OOP methodology, defining classes and variables in C#, and writing and executing C# programs. The document uses examples like a car class to illustrate concepts like classes, objects, states and behaviors.
Java annotations provide a way to decorate programs with additional metadata information without directly affecting program semantics. Annotations can be read from source code, class files, or reflectively at runtime. The Java Metadata Facility specification defines how annotations can be declared and used. Annotations allow for more declarative programming by specifying what to do rather than how to do it.
Here are the steps to implement a filter to redirect requests to a maintenance page:
1. Create a class that implements the Filter interface.
2. Add init(), doFilter() and destroy() methods.
3. In doFilter(), get the request URI and check if it is the home page URL.
4. If it is the home page, get the response and send a redirect to the maintenance page.
5. Else, pass the request and response to the filter chain.
6. Map the filter in web.xml, specifying the URL pattern as /* to apply to all requests.
7. Create the maintenance page that displays the message.
8. Deploy and test
The document summarizes the results of analyzing the OpenCV computer vision library with the PVS-Studio code analyzer. Several real bugs were found in older versions of OpenCV and have since been fixed. New analysis of the current OpenCV version uncovered additional bugs, including copy-paste errors, meaningless loops, misprints in conditions, pointer errors, and poor test cases. The analysis demonstrates that static analysis is useful for finding real bugs in large, complex libraries like OpenCV during development.
The article describes the testing technologies used when developing PVS-Studio static code analyzer. The developers of the tool for programmers talk about the principles of testing their own program product which can be interesting for the developers of similar packages for processing text data or source code.
How to make fewer errors at the stage of code writing. Part N4.PVS-Studio
This is the fourth post in which I want to share with you some useful observations on error patterns and the ways of fighting them. This time I will touch upon the subject of handling rare and emergency conditions in programs. While examining a number of applications, I came to a conclusion that the error handling code is one of the most unreliable parts in C/C++ programs' sources. What are the consequences of such defects? An application must generate the message "file X is not found" but instead it crashes and forces the user to make guesses about what he/she is doing wrong. A program handling a data base produces an incomprehensible message instead of telling the user that there is just a field filled in incorrectly. Let's try to fight against this type of errors that haunt our users.
The document discusses how programmers often wrongly blame compilers for errors in their own code. It provides examples from open source code where errors like using the wrong size argument in memset() and memcpy() led programmers to incorrectly accuse the compiler. The author advises thoroughly investigating one's own code before blaming compilers, to avoid looking silly and to more quickly find and fix real errors.
We have checked the Windows 8 Driver Samples pack with our analyzer PVS-Studio and found various bugs in its samples. There is nothing horrible about it - bugs can be found everywhere, so the title of this article may sound a bit high-flown. But these particular errors may be really dangerous, as it is a usual practice for developers to use demo samples as a basis for their own projects or borrow code fragments from them.
Comparing the general static analysis in Visual Studio 2010 and PVS-Studio by...PVS-Studio
The article demonstrates errors detected with the static code analyzer integrated into Visual Studio 2010. The research was performed on five open source projects. The same projects were also checked with PVS-Studio. Results of comparing these two tools are presented at the end of the article.
The PVS-Studio developers' team has carried out comparison of the own static code analyzer PVS-Studio with the open-source Cppcheck static code analyzer. As a material for comparison, the source codes of the three open-source projects by id Software were chosen: Doom 3, Quake 3: Arena, Wolfenstein: Enemy Territory. The article describes the comparison methodology and lists of detected errors. The conclusions section at the end of the article contains "non-conclusions" actually, as we consciously avoid drawing any conclusions: you can reproduce our comparison and draw your own ones.
This article demonstrates capabilities of the static code analysis methodology. The readers are offered to study the samples of one hundred errors found in open-source projects in C/C++. All the errors have been found with the PVS-Studio static code analyzer.
Good has won this time. To be more exact, source codes of the Chromium project have won. Chromium is one of the best projects we have checked with PVS-Studio.
Errors detected in the Visual C++ 2012 librariesPVS-Studio
Static code analysis is one of the error detection methodologies. We are glad that this methodology is becoming more and more popular nowadays. Visual Studio which includes static analysis as one of its many features contributes to this process to a large extent. This feature is easy to try and start using regularly. When one understands one likes static code analysis, we are glad to offer a professional analyzer PVS-Studio for the languages C/C++/C++11.
1) The author conducted experiments to determine if PVS-Studio could analyze code without being tied to Visual Studio. Experiments showed that properly handling include paths and duplicate file names is difficult without a project file, and preprocessing is essential for quality static analysis.
2) Compilation switches had little impact on analysis, except include paths. Preprocessing provides necessary type and symbol information.
3) Checking all files in a folder led to analyzing unnecessary files and preprocessing errors. Project structure is important for proper static analysis.
Analysis of the Trans-Proteomic Pipeline (TPP) projectPVS-Studio
To be honest, I don't know what the TPP project is intended for. As far as I understand, this is a set of tools to assist in research of proteins and their interaction in living organisms. However, that's not so much important. What is important is that their source codes are open. It means that I can check them with the PVS-Studio static analyzer. Which I'm very much fond of.
Monitoring a program that monitors computer networksPVS-Studio
The document discusses several types of errors found using static analysis on the NetXMS open source project codebase. It describes 4 examples of 64-bit errors where pointers are incorrectly cast to 32-bit types. It also mentions errors handling unsigned types like sockets, half-cleared buffers due to misunderstanding string sizes, copy-paste errors, uninitialized variables, null pointer dereferences, and incorrect variable type usage with variadic functions. The author encourages the NetXMS developers to use the static analysis tool to find and address these kinds of issues in their code.
In this article, I've collected a huge amount of links all of which could prove potentially useful to software developers who are getting acquainted with 64-bit world. In general, we will cover C/C++ languages, but I am sure, that developers from other languages will discover a lot of interesting stuff here as well.
This is a small note on the results of checking the OpenSSL project with the PVS-Studio analyzer. I analyzed the openssl-0.9.8-stable-SNAP-20121208 version.
This article covers the extension of Visual Studio by integrating into its 'Settings' dialog pages. Option page registration and integration into the IDE for different kinds of extension packages will be examined, as well as the means to display various standard and user-created components inside a custom settings page. Also covered are the ways of accessing environment settings through Visual Studio Automation model and preservation mechanism for option pages.
Having checked ReactOS's code I managed to fulfill three of my wishes at once. Firstly, I had wanted for a long time to write an article on a common project. It's not interesting to check the source code of projects like Chromium: its quality is too high and a lot of resources are spent to maintain it, which are unavailable to common projects. Secondly, it's a good example to demonstrate the necessity of static analysis in a large project, especially when it is developed by a diverse and distributed team. Thirdly, I've got a confirmation that PVS-Studio is becoming even better and more useful.
Regular use of static code analysis in team developmentPVS-Studio
Static code analysis technologies are used in companies with mature software development processes. However, there might be different levels of using and introducing code analysis tools into a development process: from manual launch of an analyzer "from time to time" or when searching for hard-to-find errors to everyday automatic launch or launch of a tool when adding new source code into the version control system.
How to make fewer errors at the stage of code writing. Part N3.PVS-Studio
This is the third article where I will tell you about a couple of new programming methods that can help you make your code simpler and safer. You may read the previous two posts here [1] and here [2]. This time we will take samples from the Qt project.
This article deals with creation, utilization and handling of Visual Studio commands in its extension modules through automation object model APIs and IDE services. The relations between IDE commands and environment UI elements, such as user menus and toolbars, will also be examined.
The OMNeT++ IDE is based on Eclipse and provides functionality for modeling networks with NED files, configuring simulations with ini files, and analyzing results. The IDE includes editors for NED and ini files that allow graphical or text editing and provide features like auto-completion, validation, and navigation views. Simulations can be run directly from the IDE and results analyzed through integrated views and editors.
Software development effort reduction with Co-oplbergmans
This talks explains the motivations for the Co-op technology: what are the challenges it addresses, in particular focusing on reducing accidental complexity, where it comes from, and a general vision on how to resolve it. Then we continue to show practical application of Co-op, including experience figures from large-scale application of a previous generation of this technology. Show a little bit about its realization, and conclude with an evaluation of the technology.
Extend Eclipse p2 framework capabilities: Add your custom installation stepsDragos_Mihailescu
This document discusses extending the capabilities of the Eclipse p2 framework by adding custom installation steps. It describes implementing a custom p2 touchpoint and action for the CodeWarrior IDE to provide a "Multi User Install" capability. This allows installing Eclipse files in both administrator-level and user-level locations to support multiple users accessing the same installation. The goal is to continue enhancing the p2 updater functionality to better manage external Eclipse files, include uninstall support for external files, and synchronize with new p2 releases from the Eclipse project.
Use Eclipse technologies to build a modern embedded IDEBenjamin Cabé
This document discusses requirements for developing an embedded integrated development environment (IDE) using Eclipse technologies. It describes using Eclipse Modeling Framework (EMF) to model embedded projects. It also discusses using EMF validation, Graphical Modeling Framework (GMF) editors, Xpand for code generation, and the CDT and DLTK plugins for code editing. The IDE will integrate model and code editing with compilation, communication with targets via the Target Communication Framework (TCF) and Remote System Explorer (RSE). The goal is to leverage the Eclipse ecosystem to quickly create a complex IDE environment focused on embedded development.
Satish Marwat collected questions from various websites to create a single document for .NET interview preparation. The document contains questions about .NET frameworks, tools, terminology, assemblies and other topics. Satish provided his email for feedback on any mistakes and wants to ensure the material is accurate.
This document contains questions that are commonly asked during .NET interviews. It was compiled by Satish Marwat from various websites on the internet. The document covers topics like .NET framework versions, tools for .NET development like Visual Studio, terminology like CLI, CLR, IL, C#, managed code, assemblies, application domains, and garbage collection. The author provides their email for feedback on any mistakes in the document.
This article covers the extension of Visual Studio IDE through integration of a custom user toolwindow into the environment. Discussed are the issues of window registration and initialization in VSPackage and Add-In plug-in modules, hosting of user components and handling of window's events and states.
The document provides an overview of unit testing and dependency injection using Entity Framework. It discusses how to achieve true unit testing through dependency injection and mocking dependencies. It provides examples of how to set up interfaces, manager classes, context classes and writing unit tests using Rhino Mocks and MSTest. Code coverage is also discussed as an important part of unit testing.
This document contains a summary of questions that are commonly asked during .NET interviews. The author collected material from various websites to compile it into a single file for reference. They take no responsibility for any errors in the file and welcome feedback to correct any mistakes. Readers are asked to contact the author via email if they find any inaccuracies.
The document provides an overview of plugin development for Lotus Notes, Domino and Sametime applications using the Lotus Expeditor Toolkit. It discusses what plugins can do, how to install the Expeditor Toolkit plugin in Eclipse, the basic anatomy of a plugin, key extension points, and how to build user interfaces with SWT and jobs. The presentation also demonstrates how to create a sample plugin that reads data from a web service and displays it in a sidebar panel.
App42 Unity3d Plugin for iOS allows you to implement iOS native code and with this sample you can add objective c side codes without making changes directly to the Unity generated Xcode project.
Spring boot is a suite, pre-configured, pre-sugared set of frameworks/technologies to reduce boilerplate configuration providing you the shortest way to have a Spring web application up and running with smallest line of code/configuration out-of-the-box.
Object-oriented programming (OOP) with Complete understanding modulesDurgesh Singh
The document provides an overview of object-oriented programming concepts in C# such as classes, objects, encapsulation, inheritance, polymorphism, and reusability. It discusses class definitions, constructors, destructors, access modifiers, and provides examples of creating classes and class libraries. Key topics covered include defining fields and methods, instantiating objects, using constructors, creating partial and static classes, and building class library components for reuse across applications.
Repository Pattern in MVC3 Application with Entity FrameworkAkhil Mittal
The document discusses implementing a repository pattern in an MVC application using Entity Framework. It begins with an introduction and roadmap of previous articles. It then discusses the benefits of a repository pattern in abstracting the data access layer from business logic. Steps are provided to create a sample repository interface and class to implement basic CRUD operations on a User entity, abstracting the data access code from the controller. The repository class uses the Entity Framework context to perform operations while resolving tight coupling issues between layers. It concludes that while this implementation works for a single entity, a generic repository will be needed to cleanly support multiple entities without duplication.
Generic Repository Pattern in MVC3 Application with Entity FrameworkAkhil Mittal
This document discusses implementing a generic repository pattern and unit of work pattern in an MVC application using Entity Framework. It begins by introducing the concepts of a generic repository and unit of work. It then shows how to create a generic repository class that can be used for any entity. A unit of work class is created to manage transactions and repositories. Properties on the unit of work class provide access to repositories without having to create separate classes. CRUD operations on entities are demonstrated using the generic repository through the unit of work. This completes the tutorial on implementing these patterns to reduce redundant code and complexity in an MVC application.
Patterns (contd)Software Development ProcessDesign patte.docxdanhaley45372
Patterns (contd)
Software Development Process
Design patterns used to handle change
More time extending and changing code than developing it.
The Strategy design pattern handle change by selecting from a family of external algorithms rather than rewrite.
Design point: Make code closed for modification of code, but open for extension
Problem
Computer object created
Description Method returns
Getting a Computer
Problem
Program has to change every time
Customer changes options
Decorator Pattern
Wrapper code used to extend your core code
Extend a class dynamically at runtime
Decorator uses wrapper code to extend core functionality - decorating the code
Decorator Pattern
description() returns “You are getting a computer”
Wrapper description() returns
“You are getting a computer and a disk”
Wrapper description() returns
“You are getting a computer and a disk and a monitor”
Decorator Pattern
Core component: Computer
Variables holding computer objects should also be able to hold objects that wrap computer objects.
Extend the wrapper classes from the Computer class.
Abstract class cannot be instantiated
Ensures all wrappers are consistent
Developers have to provide their own description
Decorator Pattern
Method calls the core computer object’s
description method and adds “and a disk”
Decorator Pattern
Method calls the core computer object’s
description method and adds “and a disk”
Extend the core object by wrapping it in decorator wrappers. Avoids modification of the core code.
Each successive wrapper called the description method of the object it wrapped and added something to it.
Factory Pattern
Based on type, call the
Connection method
Factory Pattern
Create a method that returns the
correct connection type
Factory Pattern
New operator used to create OracleConnection objects.
New operator used to create SqlServerConnection objects, and MySqlConnection objects.
New operator to instantiate many different concrete classes
Code becomes larger and needs to be replicated in many places
Factor that code out into a method.
Code keeps changing
Encapsulate code into a factory object
Goal: Separate out the changeable code and leave the core code closed for modification
Building the Factory
Creating the Factory
FirstFactory class encapsulates the connection object creation
Pass to it the type of connection (“Oracle”, “SQL Server”,)
Use the factory object to create connection objects with a factory method named createConnection
Building the Factory
Create the FirstFactory class.
Save the type of the database, passed to the FirstFactory class’s constructor.
Object-creation code changes
Check which type of object to be created
(OracleConnection, SqlServerConnection,
and then create it.
Factory Class
Create the Abstract Connection Class
Core code should not be modified or has to be modified
as little as possible.
Using the connection object returned by the
new factory object
Use t.
This document provides release notes and supplementary information for Delphi 7. It notes that some components have been deprecated and recommends newer alternatives. It also describes changes made to string handling functions, warnings added by the compiler, and issues fixed in streaming of subcomponents. Finally, it provides notes on various other topics like Apache, UDDI, Windows XP input, and databases.
This article covers the structure of Visual C++ project model (VCProject). Also included are the cases of using the project model for enumeration of project elements and obtaining their compilation properties through the corresponding configurations.
MODEL DRIVEN ARCHITECTURE, CONTROL SYSTEMS AND ECLIPSEAnže Vodovnik
This paper describes the use of model driven architecture and its application in control system development. It also presents a prototype solution based on the Eclipse framework implemented by the author.
Anže Vodovnik, Klemen Žagar, Cosylab, Ljubljana, Slovenija
Similar to Visual Studio Automation Object Model. EnvDTE interfaces (20)
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsDianaGray10
Join us to learn how UiPath Apps can directly and easily interact with prebuilt connectors via Integration Service--including Salesforce, ServiceNow, Open GenAI, and more.
The best part is you can achieve this without building a custom workflow! Say goodbye to the hassle of using separate automations to call APIs. By seamlessly integrating within App Studio, you can now easily streamline your workflow, while gaining direct access to our Connector Catalog of popular applications.
We’ll discuss and demo the benefits of UiPath Apps and connectors including:
Creating a compelling user experience for any software, without the limitations of APIs.
Accelerating the app creation process, saving time and effort
Enjoying high-performance CRUD (create, read, update, delete) operations, for
seamless data management.
Speakers:
Russell Alfeche, Technology Leader, RPA at qBotic and UiPath MVP
Charlie Greenberg, host
Session 1 - Intro to Robotic Process Automation.pdfUiPathCommunity
👉 Check out our full 'Africa Series - Automation Student Developers (EN)' page to register for the full program:
https://bit.ly/Automation_Student_Kickstart
In this session, we shall introduce you to the world of automation, the UiPath Platform, and guide you on how to install and setup UiPath Studio on your Windows PC.
📕 Detailed agenda:
What is RPA? Benefits of RPA?
RPA Applications
The UiPath End-to-End Automation Platform
UiPath Studio CE Installation and Setup
💻 Extra training through UiPath Academy:
Introduction to Automation
UiPath Business Automation Platform
Explore automation development with UiPath Studio
👉 Register here for our upcoming Session 2 on June 20: Introduction to UiPath Studio Fundamentals: https://community.uipath.com/events/details/uipath-lagos-presents-session-2-introduction-to-uipath-studio-fundamentals/
What is an RPA CoE? Session 2 – CoE RolesDianaGray10
In this session, we will review the players involved in the CoE and how each role impacts opportunities.
Topics covered:
• What roles are essential?
• What place in the automation journey does each role play?
Speaker:
Chris Bolin, Senior Intelligent Automation Architect Anika Systems
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving
What began over 115 years ago as a supplier of precision gauges to the automotive industry has evolved into being an industry leader in the manufacture of product branding, automotive cockpit trim and decorative appliance trim. Value-added services include in-house Design, Engineering, Program Management, Test Lab and Tool Shops.
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdfleebarnesutopia
So… you want to become a Test Automation Engineer (or hire and develop one)? While there’s quite a bit of information available about important technical and tool skills to master, there’s not enough discussion around the path to becoming an effective Test Automation Engineer that knows how to add VALUE. In my experience this had led to a proliferation of engineers who are proficient with tools and building frameworks but have skill and knowledge gaps, especially in software testing, that reduce the value they deliver with test automation.
In this talk, Lee will share his lessons learned from over 30 years of working with, and mentoring, hundreds of Test Automation Engineers. Whether you’re looking to get started in test automation or just want to improve your trade, this talk will give you a solid foundation and roadmap for ensuring your test automation efforts continuously add value. This talk is equally valuable for both aspiring Test Automation Engineers and those managing them! All attendees will take away a set of key foundational knowledge and a high-level learning path for leveling up test automation skills and ensuring they add value to their organizations.
What is an RPA CoE? Session 1 – CoE VisionDianaGray10
In the first session, we will review the organization's vision and how this has an impact on the COE Structure.
Topics covered:
• The role of a steering committee
• How do the organization’s priorities determine CoE Structure?
Speaker:
Chris Bolin, Senior Intelligent Automation Architect Anika Systems
In the realm of cybersecurity, offensive security practices act as a critical shield. By simulating real-world attacks in a controlled environment, these techniques expose vulnerabilities before malicious actors can exploit them. This proactive approach allows manufacturers to identify and fix weaknesses, significantly enhancing system security.
This presentation delves into the development of a system designed to mimic Galileo's Open Service signal using software-defined radio (SDR) technology. We'll begin with a foundational overview of both Global Navigation Satellite Systems (GNSS) and the intricacies of digital signal processing.
The presentation culminates in a live demonstration. We'll showcase the manipulation of Galileo's Open Service pilot signal, simulating an attack on various software and hardware systems. This practical demonstration serves to highlight the potential consequences of unaddressed vulnerabilities, emphasizing the importance of offensive security practices in safeguarding critical infrastructure.
This talk will cover ScyllaDB Architecture from the cluster-level view and zoom in on data distribution and internal node architecture. In the process, we will learn the secret sauce used to get ScyllaDB's high availability and superior performance. We will also touch on the upcoming changes to ScyllaDB architecture, moving to strongly consistent metadata and tablets.
Introducing BoxLang : A new JVM language for productivity and modularity!Ortus Solutions, Corp
Just like life, our code must adapt to the ever changing world we live in. From one day coding for the web, to the next for our tablets or APIs or for running serverless applications. Multi-runtime development is the future of coding, the future is to be dynamic. Let us introduce you to BoxLang.
Dynamic. Modular. Productive.
BoxLang redefines development with its dynamic nature, empowering developers to craft expressive and functional code effortlessly. Its modular architecture prioritizes flexibility, allowing for seamless integration into existing ecosystems.
Interoperability at its Core
With 100% interoperability with Java, BoxLang seamlessly bridges the gap between traditional and modern development paradigms, unlocking new possibilities for innovation and collaboration.
Multi-Runtime
From the tiny 2m operating system binary to running on our pure Java web server, CommandBox, Jakarta EE, AWS Lambda, Microsoft Functions, Web Assembly, Android and more. BoxLang has been designed to enhance and adapt according to it's runnable runtime.
The Fusion of Modernity and Tradition
Experience the fusion of modern features inspired by CFML, Node, Ruby, Kotlin, Java, and Clojure, combined with the familiarity of Java bytecode compilation, making BoxLang a language of choice for forward-thinking developers.
Empowering Transition with Transpiler Support
Transitioning from CFML to BoxLang is seamless with our JIT transpiler, facilitating smooth migration and preserving existing code investments.
Unlocking Creativity with IDE Tools
Unleash your creativity with powerful IDE tools tailored for BoxLang, providing an intuitive development experience and streamlining your workflow. Join us as we embark on a journey to redefine JVM development. Welcome to the era of BoxLang.
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...Fwdays
Direct losses from downtime in 1 minute = $5-$10 thousand dollars. Reputation is priceless.
As part of the talk, we will consider the architectural strategies necessary for the development of highly loaded fintech solutions. We will focus on using queues and streaming to efficiently work and manage large amounts of data in real-time and to minimize latency.
We will focus special attention on the architectural patterns used in the design of the fintech system, microservices and event-driven architecture, which ensure scalability, fault tolerance, and consistency of the entire system.
In our second session, we shall learn all about the main features and fundamentals of UiPath Studio that enable us to use the building blocks for any automation project.
📕 Detailed agenda:
Variables and Datatypes
Workflow Layouts
Arguments
Control Flows and Loops
Conditional Statements
💻 Extra training through UiPath Academy:
Variables, Constants, and Arguments in Studio
Control Flow in Studio
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...AlexanderRichford
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation Functions to Prevent Interaction with Malicious QR Codes.
Aim of the Study: The goal of this research was to develop a robust hybrid approach for identifying malicious and insecure URLs derived from QR codes, ensuring safe interactions.
This is achieved through:
Machine Learning Model: Predicts the likelihood of a URL being malicious.
Security Validation Functions: Ensures the derived URL has a valid certificate and proper URL format.
This innovative blend of technology aims to enhance cybersecurity measures and protect users from potential threats hidden within QR codes 🖥 🔒
This study was my first introduction to using ML which has shown me the immense potential of ML in creating more secure digital environments!
AI in the Workplace Reskilling, Upskilling, and Future Work.pptxSunil Jagani
Discover how AI is transforming the workplace and learn strategies for reskilling and upskilling employees to stay ahead. This comprehensive guide covers the impact of AI on jobs, essential skills for the future, and successful case studies from industry leaders. Embrace AI-driven changes, foster continuous learning, and build a future-ready workforce.
Read More - https://bit.ly/3VKly70
AppSec PNW: Android and iOS Application Security with MobSFAjin Abraham
Mobile Security Framework - MobSF is a free and open source automated mobile application security testing environment designed to help security engineers, researchers, developers, and penetration testers to identify security vulnerabilities, malicious behaviours and privacy concerns in mobile applications using static and dynamic analysis. It supports all the popular mobile application binaries and source code formats built for Android and iOS devices. In addition to automated security assessment, it also offers an interactive testing environment to build and execute scenario based test/fuzz cases against the application.
This talk covers:
Using MobSF for static analysis of mobile applications.
Interactive dynamic security assessment of Android and iOS applications.
Solving Mobile app CTF challenges.
Reverse engineering and runtime analysis of Mobile malware.
How to shift left and integrate MobSF/mobsfscan SAST and DAST in your build pipeline.
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...Jason Yip
The typical problem in product engineering is not bad strategy, so much as “no strategy”. This leads to confusion, lack of motivation, and incoherent action. The next time you look for a strategy and find an empty space, instead of waiting for it to be filled, I will show you how to fill it in yourself. If you’re wrong, it forces a correction. If you’re right, it helps create focus. I’ll share how I’ve approached this in the past, both what works and lessons for what didn’t work so well.
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Visual Studio Automation Object Model. EnvDTE interfaces
1. Visual Studio Automation Object Model.
EnvDTE interfaces.
Author: Paul Eremeev
Date: 18.10.2012
Abstract
This article contains an overview of Visual Studio Automation Object Model. Model's overall structure
and the means of obtaining access to its interfaces through DTE/DTE2 top level objects are examined.
Several examples of utilizing elements of the model are provided. Also discussed are the issues of using
model's interfaces within multithreaded applications; an example of implementing such mechanism for
multithreaded interaction with COM interfaces in managed code is provided as well.
Introduction
Visual Studio development environment is built upon the principles of automation and extensibility,
providing the developers using it with the ability of integrating almost any custom element into the IDE
and allowing for an easy interaction with its default and user-created components. As the means of
implementing these tasks, Visual Studio users are provided with several cross-complementing toolsets,
the most basic and versatile among these is the Visual Studio Automation Object Model.
Automation Object Model is represented by a series of libraries containing a vast and well-structured
API set which covers all aspects of IDE automation and the majority of its extensibility capabilities.
Although, in comparison to other IDE extensibility tools, this model does not provide access to some
portions of Visual Studio (this applies mostly to the extension of some IDE's features), it is nonetheless
the most flexible and versatile among them.
The majority of the model's interfaces are accessible from within every type of IDE extension module,
which allows interacting with the environment even from an external independent process. Moreover,
the model itself could be extended along with the extension of Visual Studio IDE, providing other third-
party developers with an access to user-created custom components.
Automation Object Model structure
Visual Studio automation model is composed of several interconnected functional object groups
covering all aspects of the development environment; it also provides capabilities for controlling and
extending these groups. Accessing any of them is possible through the top-level global DTE interface
(Development Tools Environment). Figure 1 shows the overall structure of the automation model and
how it is divided among functionality groups.
2. Figure 1 — Visual Studio Automation Object Model (click the picture to zoom in)
3. The model itself could be extended by user in one of the following groups:
• project models (implementing new project types, support for new languages);
• document models (implementing new document types and document editors)
• code editor level models (support for specific language constructs)
• project build-level models
Automation model could be extended from plug-ins of VSPackage type only.
Despite the model's versatility, not every group belonging to the model could be equally utilized from all
the types of IDE extensions. For instance, some of the model's capabilities are inaccessible to external
processes; these capabilities are tied to specific extension types, such as Add-In or VSPackage.
Therefore, when selecting the type for the extension to be developed, it is important to consider the
functionality that this extension will require.
Obtaining references to DTE/DTE2 objects.
In order to create a Visual Studio automation application it is necessary to obtain access to the
automation objects themselves in the first place. To accomplish this, first of all it is necessary to hook up
the correct versions of libraries containing the required managed API wrappers in the EnvDTE
namespace. Secondly, the reference to the automation model top-level object, that is the DTE2
interface, should be obtained.
In the course of Visual Studio evolution, several of its automation objects had been modified or received
some additional functionality. So, to maintain a backward compatibility with existing extension
packages, new EnvDTE80, EnvDTE90, EnvDTE100 etc. namespaces were created instead of updating the
interfaces from the original EnvDTE namespace. The majority of such updated interfaces from these
new namespaces do maintain the same names as in the original ones, but with addition of an ordinal
number at the end of the name, for example Solution and Solution2. It is advised that these updated
interfaces should be utilized when creating a new project, as they do contain the most recent
functionality. It's worth noting that properties and methods of DTE2 interface usually return object
references with types corresponding to the original DTE, i.e. accessing dte2.Solution will return Solution
and not the Solution2 as it would seem.
Although these new EnvDTE80, EnvDTE90, EnvDTE100 namespaces do contain some of the updated
functionality as mentioned above, still it is the EnvDTE interface that contains the majority of
automation objects. Therefore, in order to possess access to all of the existing interfaces, it is necessary
to link all versions of the managed COM wrapper libraries to the project, as well as to obtain the
references to DTE and also to DTE2.
The way of obtaining top-level EnvDTE object reference is dependent upon the type of IDE extension
being developed. Let's examine 3 of such extension types: Add-In, VSPackage and an MSVS-independent
external process.
Add-In extension
In the case of an Add-In extension, access to the DTE interface can be obtained inside the OnConnection
method which should be implemented for the IDTExtensibility interface that provides access to the
extension-environment interaction events. The OnConnection method is called at the moment when the
module is loaded by the IDE; it can happen either when the environment is being loaded itself or after
4. the extension was called for the first time in the IDE session. The example of obtaining the reference
follows:
public void OnConnection(object application,
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_dte2 = (DTE2)application;
...
}
An Add-In module can be initialized either at the moment of IDE start-up, or when it is called for the first
time in current IDE session. So, the connectMode can be used to correctly determine the moment of
initialization inside the OnConnection method.
switch(connectMode)
{
case ext_ConnectMode.ext_cm_UISetup:
...
break;
case ext_ConnectMode.ext_cm_Startup:
...
break;
case ext_ConnectMode.ext_cm_AfterStartup:
...
break;
case ext_ConnectMode.ext_cm_CommandLine:
...
break;
}
As in the example above, add-In could be loaded either simultaneously with the IDE itself (if the startup
option in the Add-In manager is checked), when it is called the first time or when it is called through the
command line. The ext_ConnectMode.ext_cm_UISetup option is invoked only for a single time in the
plug-in's overall lifetime, which is during its first initialization. This case should be used for initializing
user UI elements which are to be integrated into the environment (more on this later on).
If an Add-In is being loaded during Visual Studio start-up (ext_ConnectMode.ext_cm_Startup), then at
the moment OnConnect method receives control for the first time, it is possible that the IDE still is not
fully initialized itself. In such a case, it is advised to postpone the acquisition of the DTE reference until
the environment is fully loaded. The OnStartupComplete handler provided by the IDTExtensibility can be
used for this.
public void OnStartupComplete(ref Array custom)
{
...
}
5. VSPackage extension
For VSPackage type of extension, the DTE could be obtained through the global Visual Studio service
with the help of GetService method of a Package subclass:
DTE dte = MyPackage.GetService(typeof(DTE)) as DTE;
Please note that the GetService method could potentially return null in case Visual Studio is not fully
loaded or initialized at the moment of such access, i.e. it is in the so called "zombie" state. To correctly
handle this situation, it is advised that the acquisition of DTE reference should be postponed until this
interface is inquired. But in case the DTE reference is required inside the Initialize method itself, the
IVsShellPropertyEvents interface can be utilized (also by deriving our Package subclass from it) and then
the reference could be safely obtained inside the OnShellPropertyChange handler.
DTE dte;
uint cookie;
protected override void Initialize()
{
base.Initialize();
IVsShell shellService = GetService(typeof(SVsShell)) as IVsShell;
if (shellService != null)
ErrorHandler.ThrowOnFailure(
shellService.AdviseShellPropertyChanges(this,out cookie));
...
}
public int OnShellPropertyChange(int propid, object var)
{
// when zombie state changes to false, finish package initialization
if ((int)__VSSPROPID.VSSPROPID_Zombie == propid)
{
if ((bool)var == false)
{
this.dte = GetService(typeof(SDTE)) as DTE;
IVsShell shellService = GetService(typeof(SVsShell)) as IVsShell;
if (shellService != null)
ErrorHandler.ThrowOnFailure(
shellService.UnadviseShellPropertyChanges(this.cookie) );
this.cookie = 0;
}
}
return VSConstants.S_OK;
}
It should be noted that the process of VSPackage module initialization at IDE startup could vary for
different Visual Studio versions. For instance, in case of VS2005 and VS2008, an attempt at accessing
DTE during IDE startup will almost always result in null being returned, owning to the relative fast
loading times of these versions. But, one does not simply obtain access into DTE. In Visual Studio 2010
case, it mistakenly appears that one could simply obtain an access to the DTE from inside the Initialize()
6. method. In fact, this impression is a false one, as such method of DTE acquisition could potentially cause
the occasional appearance of "floating" errors which are hard to identify and debug, and even the DTE
itself may be still uninitialized when the reference is acquired. Because of these disparities, the
aforementioned acquisition method for handling IDE loading states should not be ignored on any
version of Visual Studio.
Independent external process
The DTE interface is a top-level abstraction for Visual Studio environment in the automation model. In
order to acquire a reference to this interface from an external application, its ProgID COM identifier
could be utilized; for instance, it will be "VisualStudio.DTE.10.0" for Visual Studio 2010. Consider this
example of initializing a new IDE instance and when obtaining a reference to the DTE interface.
// Get the ProgID for DTE 8.0.
System.Type t = System.Type.GetTypeFromProgID(
"VisualStudio.DTE.10.0", true);
// Create a new instance of the IDE.
object obj = System.Activator.CreateInstance(t, true);
// Cast the instance to DTE2 and assign to variable dte.
EnvDTE80.DTE2 dte = (EnvDTE80.DTE2)obj;
// Show IDE Main Window
dte.MainWindow.Activate();
In the example above we've actually created a new DTE object, starting deven.exe process by the
CreateInstance method. But at the same time, the GUI window of the environment will be displayed
only after the Activate method is called.
Next, let's review a simple example of obtaining the DTE reference from an already running Visual
Studio Instance:
EnvDTE80.DTE2 dte2;
dte2 = (EnvDTE80.DTE2)
System.Runtime.InteropServices.Marshal.GetActiveObject(
"VisualStudio.DTE.10.0");
However, in case several instances of the Visual Studio are executing at the moment of our inquiry, the
GetActiveObject method will return a reference to the IDE instance that was started the earliest. Let's
examine a possible way of obtaining the reference to DTE from a running Visual Studio instance by the
PID of its process.
using EnvDTE80;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
[DllImport("ole32.dll")]
private static extern void CreateBindCtx(int reserved,
out IBindCtx ppbc);
[DllImport("ole32.dll")]
private static extern void GetRunningObjectTable(int reserved,
out IRunningObjectTable prot);
7. public static DTE2 GetByID(int ID)
{
//rot entry for visual studio running under current process.
string rotEntry = String.Format("!VisualStudio.DTE.10.0:{0}", ID);
IRunningObjectTable rot;
GetRunningObjectTable(0, out rot);
IEnumMoniker enumMoniker;
rot.EnumRunning(out enumMoniker);
enumMoniker.Reset();
IntPtr fetched = IntPtr.Zero;
IMoniker[] moniker = new IMoniker[1];
while (enumMoniker.Next(1, moniker, fetched) == 0)
{
IBindCtx bindCtx;
CreateBindCtx(0, out bindCtx);
string displayName;
moniker[0].GetDisplayName(bindCtx, null, out displayName);
if (displayName == rotEntry)
{
object comObject;
rot.GetObject(moniker[0], out comObject);
return (EnvDTE80.DTE2)comObject;
}
}
return null;
}
Here we've acquired the DTE interface by identifying the required instance of the IDE in the table of
running COM objects (ROT, Running Object Table) by its process identifier. Now we can access the DTE
for every of the executing instances of Visual Studio, for example:
Process Devenv;
...
//Get DTE by Process ID
EnvDTE80.DTE2 dte2 = GetByID(Devenv.Id);
Additionally, to acquire any project-specific interface (including custom model extensions), for example
the CSharpProjects model, through a valid DTE interface, the GetObject method should be utilized:
Projects projects = (Projects)dte.GetObject("CSharpProjects");
The GetObject method will return a Projects collection of regular Project objects, and each one of them
will contain a reference to our project-specific properties, among other regular ones.
Visual Studio text editor documents
Automation model represents Visual Studio text documents through the TextDocument interface. For
example, C/C++ source code files are opened by the environment as text documents. TextDocument is
based upon the common automation model document interface (the Document interface), which
represents file of any type opened in Visual Studio editor or designer. A reference to the text document
8. object can be obtained through the 'Object' field of the Document object. Let's acquire a text document
for the currently active (i.e. the one possessing focus) document from IDE's text editor.
EnvDTE.TextDocument objTextDoc =
(TextDocument)PVSStudio.DTE.ActiveDocument.Object("TextDocument");
Modifying documents
The TextSelection document allows controlling text selection or to modify it. The methods of this
interface represent the functionality of Visual Studio text editor, i.e. they allow the interaction with the
text as it presented directly by the UI.
EnvDTE.TextDocument Doc =
(TextDocument)PVSStudio.DTE.ActiveDocument.Object(string.Empty);
Doc.Selection.SelectLine();
TextSelection Sel = Doc.Selection;
int CurLine = Sel.TopPoint.Line;
String Text = Sel.Text;
Sel.Insert("testrn");
In this example we selected a text line under the cursor, read the selected text and replaced it with a
'test' string.
TextDocument interface also allows text modification through the EditPoint interface. This interface is
somewhat similar to the TextSelection, but instead of operating with the text through the editor UI, it
directly manipulates text buffer data. The difference between them is that the text buffer is not
influenced by such editor-specific notions as WordWrap and Virtual Spaces. It should be noted that both
of these editing methods are not able to modify read-only text blocks.
Let's examine the example of modifying text with EditPoint by placing additional lines at the end of
current line with a cursor.
objEditPt = objTextDoc.StartPoint.CreateEditPoint();
int lineNumber = objTextDoc.Selection.CurrentLine;
objEditPt.LineDown(lineNumber - 1);
EditPoint objEditPt2 = objTextDoc.StartPoint.CreateEditPoint();
objEditPt2.LineDown(lineNumber - 1);
objEditPt2.CharRight(objEditPt2.LineLength);
String line = objEditPt.GetText(objEditPt.LineLength);
String newLine = line + "test";
objEditPt.ReplaceText(objEditPt2, newLine,
(int)vsEPReplaceTextOptions.vsEPReplaceTextKeepMarkers);
Navigating the documents
VSPackage modules are able to obtain access to a series of global services which could be used for
opening and handling environment documents. These services could be acquired by the
Package.GetGlobalService() method. It should be noted that the services described here are not part of
the DTE model and are accessible only from a Package-type extension, and therefore they could not be
utilized in other types of Visual Studio extensions. Nonetheless, they can be quite useful for handling IDE
9. documents when they are utilized in addition to the Documents interface described earlier. Next, we'll
examine these services in more detail.
The IVsUIShellOpenDocument interface controls the state of documents opened in the environment.
Following is the example that uses this interface to open a document through path to a file which this
document will represent.
String path = "C:Testtest.cpp";
IVsUIShellOpenDocument openDoc =
Package.GetGlobalService(typeof(IVsUIShellOpenDocument))
as IVsUIShellOpenDocument;
IVsWindowFrame frame;
Microsoft.VisualStudio.OLE.Interop.IServiceProvider sp;
IVsUIHierarchy hier;
uint itemid;
Guid logicalView = VSConstants.LOGVIEWID_Code;
if (ErrorHandler.Failed(
openDoc.OpenDocumentViaProject(path, ref logicalView, out sp,
out hier, out itemid, out frame))
|| frame == null)
{
return;
}
object docData;
frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocData, out docData);
The file will be opened in a new editor or will receive focus in case it already has been opened earlier.
Next, let's read a VsTextBuffer text buffer from this document we opened:
// Get the VsTextBuffer
VsTextBuffer buffer = docData as VsTextBuffer;
if (buffer == null)
{
IVsTextBufferProvider bufferProvider = docData as
IVsTextBufferProvider;
if (bufferProvider != null)
{
IVsTextLines lines;
ErrorHandler.ThrowOnFailure(bufferProvider.GetTextBuffer(
out lines));
buffer = lines as VsTextBuffer;
Debug.Assert(buffer != null,
"IVsTextLines does not implement IVsTextBuffer");
if (buffer == null)
{
return;
}
}
}
10. The IVsTextManager interface controls all of the active text buffers in the environment. For example we
can navigate a text document using the NavigateToLineAndColumn method of this manager on a buffer
we've acquired earlier:
IVsTextManager mgr =
Package.GetGlobalService(typeof(VsTextManagerClass))
as IVsTextManager;
mgr.NavigateToLineAndColumn(buffer, ref logicalView, line,
column, line, column);
Subscribing and handling events
Automation objects events are represented by the DTE.Events property. This element references all of
the common IDE events (such as CommandEvents, SolutionEvents), as well as the events of separate
environment components (project types, editors, tools etc.), also including the ones designed by third-
party developers. To acquire a reference for this automation object, the GetObject method could be
utilized.
When subscribing to the DTE events one should remember that this interface could be still unavailable
at the moment of extension being initialized. So it is always important to consider the sequence of your
extension initialization process if the access to DTE.Events is required in the Initialize() method of your
extension package. The correct handling of initialization sequence will vary for different extension types,
as it was described earlier.
Let's acquire a reference for an events object of Visual C++ project model defined by the
VCProjectEngineEvents interface and assign a handler for the removal of an element from the Solution
Explorer tree:
VCProjectEngineEvents m_ProjectItemsEvents =
PVSStudio.DTE.Events.GetObject("VCProjectEngineEventsObject")
as VCProjectEngineEvents;
m_ProjectItemsEvents.ItemRemoved +=
new _dispVCProjectEngineEvents_ItemRemovedEventHandler(
m_ProjectItemsEvents_ItemRemoved);
MDI windows events
The Events.WindowEvents property could be utilized to handle regular events of an environment MDI
window. This interface permits the assignment of a separate handler for a single window (defined
through the EnvDTE.Window interface) or the assignment of a common handler for all of the
environment's windows. Following example contains the assignment of a handler for the event of
switching between IDE windows:
WindowEvents WE = PVSStudio.DTE.Events.WindowEvents;
WE.WindowActivated +=
new _dispWindowEvents_WindowActivatedEventHandler(
Package.WE_WindowActivated);
Next example is the assignment of a handler for window switching to the currently active MDI window
through WindowEvents indexer:
11. WindowEvents WE =
m_dte.Events.WindowEvents[MyPackage.DTE.ActiveWindow];
WE.WindowActivated += new
_dispWindowEvents_WindowActivatedEventHandler(
MyPackage.WE_WindowActivated);
IDE commands events
The actual handling of environment's commands and their extension through the automation model is
covered in a separate article of this series. In this section we will examine the handling of the events
related to these commands (and not of the execution of the commands themselves). Assigning the
handlers to these events is possible through the Events.CommandEvents interface. The CommandEvents
property, as in the case of MDI windows events, also permits the assignment of a handler either for all
of the commands or for a single one through the indexer.
Let's examine the assignment of a handler for the event of a command execution being complete (i.e.
when the command finishes its execution):
CommandEvents CEvents = DTE.Events.CommandEvents;
CEvents.AfterExecute += new
_dispCommandEvents_AfterExecuteEventHandler(C_AfterExecute);
But in order to assign such a handler for an individual command, it is necessary to identify this command
in the first place. Each command of the environment is identified by a pair of GUID:ID, and in case of a
user-created commands these values are specified directly by the developer during their integration, for
example through the VSCT table. Visual Studio possesses a special debug mode which allows identifying
any of the environment's comamnds. To activate this mode, it is required that the following key is to be
added to the system registry (an example for Visual Studio 2010):
[HKEY_CURRENT_USERSoftwareMicrosoftVisualStudio10.0General]
"EnableVSIPLogging"=dword:00000001
Now, after restarting the IDE, hovering your mouse over menu or toolbar elements with CTRL+SHIFT
being simultaneously pressed (though sometime it will not work until you left-click it) will display a
dialog window containing all of the command's internal identifiers. We are interested in the values of
Guid and CmdID. Let's examine the handling of events for the File.NewFile command:
CommandEvents CEvents = DTE.Events.CommandEvents[
"{5EFC7975-14BC-11CF-9B2B-00AA00573819}", 221];
CEvents.AfterExecute += new
_dispCommandEvents_AfterExecuteEventHandler(C_AfterExecute);
The handler obtained in this way will receive control only after the command execution is finished.
void C_AfterExecute(string Guid, int ID, object CustomIn,
object CustomOut)
{
...
}
12. This handler should not be confused with an immediate handler for the execution of the command itself
which could be assigned during this command's initialization (from an extension package and in case the
command is user-created). Handling the IDE commands is described in a separate article that is entirely
devoted to IDE commands.
In conclusion to this section it should be mentioned that in the process of developing our own
VSPackage extension, we've encountered the necessity to store the references to interface objects
containing our handler delegates (such as CommandEvents, WindowEvents etc.) on the top-level fields
of our main Package subclass. The reason for this is that in case of the handler being assigned through a
function-level local variable, it is lost immediately after leaving the method. Such behavior could
probably be attributed to the .NET garbage collector, although we've obtained these references from
the DTE interface which definitely exists during the entire lifetime of our extension package.
Interacting with DTE2 COM interfaces from within a multithreaded
application
Initially PVS-Studio extension package had not contained any specific thread-safety mechanisms for its
interaction with Visual Studio APIs. At the same time, we had been attempting to confine the
interactions with this APIs within a single background thread which was created and owned by our plug-
in. And such approach functioned flawlessly for quite a long period. However, several bug reports from
our users, each one containing a similar ComExeption error, prompted us to examine this issue in more
detail and to implement a threading safety mechanism for our COM Interop.
Although Visual Studio automation model is not a thread-safe one, it still provides a way for interacting
with multi-threaded applications. Visual Studio application is a COM (Component Object Mode) server.
For the task of handling calls from COM clients (in our case, this will be our extension package) to
thread-unsafe servers, COM provides a mechanism known as STA (single-threaded apartment) model. In
the terms of COM, an Apartment represents a logical container inside a process in which objects and
threads share the same thread access rules. STA can hold only a single thread, but an unlimited number
of objects, inside such container. Calls from other threads to such thread-unsafe objects inside STA are
converted into messages and posted to a message queue. Messages are retrieved from the message
queue and converted back into method calls one at a time by the thread running in the STA, so it
becomes possible for only a single thread to access these unsafe objects on the server.
Utilizing Apartment mechanism inside managed code
The .NET Framework does not utilize COM Apartment mechanics directly. Therefore, when a managed
application calls a COM object in the COM interoperation scenarios, CLR (Common Language Runtime)
creates and initializes apartment container. A managed thread is able to create and enter either an MTA
(multi-threaded apartment, a container that, contrary to STA, can host several threads at the same
time), or an STA, though a thread will be started as an MTA by default. The type of the apartment could
be specified before thread is launched:
Thread t = new Thread(ThreadProc);
t.SetApartmentState(ApartmentState.STA);
...
t.Start();
13. As an apartment type could not be changed once thread had been started, the STAThread attribute
should be used to specify the main thread of a managed application as an STA:
[STAThread]
static void Main(string[] args)
{...}
Implementing message filter for COM interoperation errors in a managed environment
As STA serializes all of calls to the COM server, one of the calling clients could potentially be blocked or
even rejected when the server is busy, processing different calls or another thread is already inside the
apartment container. In case COM server rejects its client, .NET COM interop will generate a
System.Runtime.InteropServices.COMException ("The message filter indicated that the application is
busy").
When working on a Visual Studio module (add-in, vspackage) or a macro, the execution control usually
passes into the module from the environment's main STA UI thread (such as in case of handling events
or environment state changes, etc.). Calling automation COM interfaces from this main IDE thread is
safe. But if other background threads are planned to be utilized and EnvDTE COM interfaces are to be
called from these background threads (as in case of long calculations that could potentially hang the
IDE's interface, if these are performed on the main UI thread), then it is advised to implement a
mechanism for handling calls rejected by a server.
While working on PVS-Studio plug-in we've often encountered these kinds of COM exceptions in
situations when other third-party extensions were active inside the IDE simultaneously with PVS-Studio
plug-in. Heavy user interaction with the UI also was the usual cause for such issues. It is quite logical that
these situations often resulted in simultaneous parallel calls to COM objects inside STA and
consequently to the rejection of some of them.
To selectively handle incoming and outgoing calls, COM provides the IMessageFilter interface. If it is
implemented by the server, all of the calls are passed to the HandleIncomingCall method, and the client
is informed on the rejected calls through the RetryRejectedCall method. This in turn allows the rejected
calls to be repeated, or at least to correctly present this rejection to a user (for example, by displaying a
dialog with a 'server is busy' message). Following is the example of implementing the rejected call
handling for a managed application.
[ComImport()]
[Guid("00000016-0000-0000-C000-000000000046")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IMessageFilter
{
[PreserveSig]
int HandleInComingCall(
int dwCallType,
IntPtr hTaskCaller,
int dwTickCount,
IntPtr lpInterfaceInfo);
[PreserveSig]
int RetryRejectedCall(
14. IntPtr hTaskCallee,
int dwTickCount,
int dwRejectType);
[PreserveSig]
int MessagePending(
IntPtr hTaskCallee,
int dwTickCount,
int dwPendingType);
}
class MessageFilter : MarshalByRefObject, IDisposable, IMessageFilter
{
[DllImport("ole32.dll")]
[PreserveSig]
private static extern int CoRegisterMessageFilter(
IMessageFilter lpMessageFilter,
out IMessageFilter lplpMessageFilter);
private IMessageFilter oldFilter;
private const int SERVERCALL_ISHANDLED = 0;
private const int PENDINGMSG_WAITNOPROCESS = 2;
private const int SERVERCALL_RETRYLATER = 2;
public MessageFilter()
{
//Starting IMessageFilter for COM objects
int hr =
MessageFilter.CoRegisterMessageFilter(
(IMessageFilter)this,
out this.oldFilter);
System.Diagnostics.Debug.Assert(hr >= 0,
"Registering COM IMessageFilter failed!");
}
public void Dispose()
{
//disabling IMessageFilter
IMessageFilter dummy;
int hr = MessageFilter.CoRegisterMessageFilter(this.oldFilter,
out dummy);
System.Diagnostics.Debug.Assert(hr >= 0,
"De-Registering COM IMessageFilter failed!")
System.GC.SuppressFinalize(this);
}
int IMessageFilter.HandleInComingCall(int dwCallType,
IntPtr threadIdCaller, int dwTickCount, IntPtr lpInterfaceInfo)
{
15. // Return the ole default (don't let the call through).
return MessageFilter.SERVERCALL_ISHANDLED;
}
int IMessageFilter.RetryRejectedCall(IntPtr threadIDCallee,
int dwTickCount, int dwRejectType)
{
if (dwRejectType == MessageFilter.SERVERCALL_RETRYLATER)
{
// Retry the thread call immediately if return >=0 &
// <100.
return 150; //waiting 150 mseconds until retry
}
// Too busy; cancel call. SERVERCALL_REJECTED
return -1;
//Call was rejected by callee.
//(Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))
}
int IMessageFilter.MessagePending(
IntPtr threadIDCallee, int dwTickCount, int dwPendingType)
{
// Perform default processing.
return MessageFilter.PENDINGMSG_WAITNOPROCESS;
}
}
Now we can utilize our MessageFilter while calling COM interfaces from a background thread:
using (new MessageFilter())
{
//COM-interface dependent code
...
}
References
1. MSDN. Referencing Automation Assemblies and the DTE2 Object.
2. MSDN. Functional Automation Groups.
3. MZ-Tools. HOWTO: Use correctly the OnConnection method of a Visual Studio add-in.
4. The Code Project. Understanding The COM Single-Threaded Apartment.
5. MZ-Tools. HOWTO: Add an event handler from a Visual Studio add-in.
6. Dr. eX's Blog. Using EnableVSIPLogging to identify menus and commands with VS 2005 + SP1.
Other articles in this series
0. Introduction.
1. Creating, debugging and deploying extension packages for Microsoft Visual Studio
2005/2008/2010/2012.
2. Visual Studio Automation Object Model. EnvDTE interfaces.
16. 3. Visual Studio commands.
4. Visual Studio tool windows.
5. Integrating into Visual Studio settings.
6. Visual C++ project model.