I have a tutorial to implement "My Own ILDASM" , may I know what approach i can use.
I have visual studio 2010 installed on my computer , i added MenuStrip and OpenFIleDialog.
My Questoins
1) I need to add a treeview control to display type members hierarchy in a tree
any direction will be enough
after selecting a dll from winform , how can i show that dll info in the tree view.
Any info will be appreciated.
First, bone up on reflection.
Then, build up the namespaces and have those as top level tree view items. Next get all the Types. For example: Assembly.GetTypes.
From here you should be getting the hang of it. For each type, get the methods, properies, fields etc and make the subnodes.
Related
i dont like the new interface of my search all, it suddenly change when i reinstall my visual studio
here is my search all result interface
the result suppose like this
Do you guys know how to change the result interface ?
It sounds like you are using 2 different types of search.
The first capture you provide is from Find and replace feature, that cand be raised with shortcut Ctlr + F, and when you select option "Find all". It returns a lsit fo files that match the text you are searching for. You may check Microsoft documentacion for Find and replace
The second capture represent the usage of Find references in your code, that provides a way to find where particular code elements are referenced throughout your codebase. You can find more information in Microsoft documentacion for Find references.
If you want to make use of Find references feature, you should use shortcut Shift + F12 or simply you can make right click over any object/class/element in your code, and select option Find all references.
Capture: Find all references using right click and contextual menu
Remember that this would not work with a simple piece of text, you must find references of an existant element, like a model, a class, a variable, etc.
Hope this info could be useful.
[EDIT]
Maybe I could misunderstand your question. If you refer to the theme (backgroud anf font color mainly) of the interface, you could set Light theme option, through main menu, selecting Tools menu, and then Options. once there, enter section General, under Environment option, and select Light option in dropdownlist associated with Color theme option.
Check this link (made for VS CE 2017, but work as well) to see captures of the process:
https://ourcodeworld.com/articles/read/869/how-to-change-to-a-dark-theme-in-visual-studio-community-2017
[EDIT FOR COMMENT]
I've checked it with VS 2019. As you said, default view for Find all feature looks like references result view. If you want to keep the "classic" list view, you can simply click on ListView button, at the right top, on the bar that appears over your result section, as you can see in following capture.
I would like to get the array of the selected tab objects programmatically as the selection below:
I could only find the way to get the array of selected files in the Solution Explorer:
But it is not that array that I need.
Does anyone know how to get the array of the selected tabs in C#?
The tabs in Visual Studio represent open documents; so you may want to iterate over the document collection instead, that is accessible via the Documents property of the DTE instance. See https://learn.microsoft.com/en-us/dotnet/api/envdte._dte.documents?view=visualstudiosdk-2017#EnvDTE__DTE_Documents for further information.
Each Document returned by Documents collection allows us to find related windows (those are usually document-windows, but not tool-windows); see https://learn.microsoft.com/en-us/dotnet/api/envdte.document.windows?view=visualstudiosdk-2017 for further information about objects returned by the Windows property.
The Window class has properties that might be suitable, for whatever you wanna do with it; for instance ask for its caption, visibility, type, handle, etc.., but I am not sure whether it is possible to determine or derive the information whether the document window´s tab (or document itself) is selected, or not.
As an alternative, you can also use the RunningDocumentTable service to iterate open documents; see https://learn.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.shell.runningdocumenttable?view=visualstudiosdk-2017
I am trying out the Code Map feature in VS 2017 Enterprise. However the maps get cluttered quickly. One can use the "New Graph from Selection" to create a new graph and then drill down further. However there seems no way to link the parent map to the child map, so navigating from one to another becomes very tricky. I would have expected to be able to put in a file link of some sort.
Any thoughts on this please?
It seems that one cannot do it in the GUI, one has to add a "reference" attribute to the Node element in the DGML file
<Node Id="#29" Category="CodeSchema_Method" Bounds="629.838307291667,-192.520041836548,154.936666666667,25.96" CodeSchemaProperty_IsPrivate="True" DelayedCrossGroupLinksState="Fetched" Label="MyMethod" UseManualLocation="True" Reference = "Graph1_1_1_1.dgml"/>
You then get a "go to reference" menu option for the relevant node.
Hope this is helpful to someone.
I want to reverse engineer a current c# Project at work. I was told to use enterprise architect. But where can I select to import the source code? I am using Version 10 Corporate Edition and it seems to me there are big differences to earlier Versions. When I select a Project there are no Options like "Code Engineering" as I have seen in many youtube videos or text tutorials.
The top-most level in the model tree consists of one or more "root nodes", sometimes referred to as "models" in the help file. One of these is created when the project is created, by default it is called "Model".
This level is only for organizing model packages and is very restricted in what you can do with it. You cannot place diagrams or classes directly under a root node, and you cannot reverse-engineer code to a root node. Root nodes are not, strictly speaking, UML packages.
Instead, you must create a package in the root node. The first level below the root is called "view", but view packages are regular UML packages and you can do anything with them, including show them in diagrams, draw connectors to them and import code into them.
When you create a view, EA asks you what icon to display. This is GUI sugar only, and has no effect on what you can place inside the package.
The thing to keep in mind is that while you can move regular packages freely around the tree if you want, you cannot move root nodes or view packages to other levels. In other words, you cannot turn a view into a root node and you cannot place a view inside another view. For this reason, it might be a good idea to create a regular package inside your view before you import your code.
So: create a view inside the "Model" root node, and preferably another package in the view. You will be able to import code into either.
Addendum after the screenshot was added:
You need at least the Professional license to do code engineering at all. If you've got that, you're either working in a project where you don't have the necessary privileges to do reverse engineering (and need to contact the project administrator to get it), or you've selected a command set that doesn't include it.
EA 10, on first start after installation, asks if you wish to customize the GUI. This actually means that a number of menu items are removed. If you can't find a menu item, go to View -- Workspaces and Commands -- Commands, and select Complete.
Solved it. Somehow some options were hidden in the default profile .... great. Reconfigured the profile and now it works.
Thanks anyway
When you are typing with Intellisense and it shows you the parameters within a class, you can select a parameter and keep going until you arrive at the base level. When you are debugging, Visual Studio lets you stop on objects and inspect all of the parameters or fields within them.
Is there a way to build a treeview or diagram of all of the class parameters? I have a large class that included ton of sub objects and properties and I would like to build a view of all of its properties.
If you are just talking about being able to visualize your classes (through Visual Studio, not actually building a hierarchy through code) you can do it like this: In Visual Studio, click View - Class View. This will give you a tree view of your classes.
If you click View - Object Browser you will see a tree view of classes in other assemblies too, not just your classes.
EDIT
I think you are looking for something like the Solution Navigator in the Productivity Power Tools Visual Studio extension. Click Tools - Extension Manager - Online Gallery. Search for Productivity Power Tools and install it. You will then see an option under the View menu for the Solution Navigator.
If you want control over the way variable values are displayed during Visual Studio debugging sessions, you can apply the DebuggerDisplay attribute to the class of interest. You can alternatively overload ToString() on the class of interest to print the info you desire, assuming that this behavior would not conflict with any other requirements you may have.