i create a generic handler (ashx) but i am trying to add region in my code like the following
#region MyRegionName
context.Response.ContentType = "text/plain";
context.Response.Write("Hello World");
#endregion
there is no error but the problem that there is no expand and collapse.
please any advice ?
note: i am using visual studio 2010
hi i think i figure out the answer my self
in visual studio go to:
1- Tools -> option -> select Text Editor.
2- in the right pane add an extension "ashx" and choose from the drop down list which editor u use .. i select microsoft visual c#.
3- in the bottom check on "map extensionless to : the same selection above.
4- click ok and close the ashx page and reopen it.
thx every body for the answers
This is by design, see the explanation here: http://forums.asp.net/t/1162769.aspx#1928580.
The problem is, that the ashx file is not handled by the C# editor but by the ASP.NET editor.
EDIT: Hang on a minute - I've just re-read your question. An .ashx file, like an .asmx or .aspx file is a markup file, not a code file. You can't use regions in these files. You can use regions in the code behind files associated with them (e.g. the .ashx.cs files) only.
Original Answer: Generally, whenever I get these sort of unexplained odd behaviours in VS2010, I reset all the settings, which normally resolves the issue.
Try Tools->Import and Export Settings->Reset All Settings and see if that fixes your region issue.
If not, it may be related to a bad add-in or extension. Try disabling extensions/add-ins to see if that fixes your problem, alternatively try starting up in safe mode and see if the IDE behaves:
DEVENV.EXE /safemode
Hope this helps.
#region yourRegionName
//your code
#endregion
Related
Recently I installed VS Code and C# plugin for it. I must say that I really like the editor. It is very lightweight and highly customizable. However I haven't found how can I redefine several colorization options such as highlighting classes inside field definitions or local variables?
I already use standard C# colorizer. I just want to customize the color of some lexemes, not everything.
Checkout the docs here:
https://code.visualstudio.com/Docs/customization/colorizer
You basically either get one from the marketplace or generate a basic editable file with yeoman.
You can also add themes even from color sublime as described here:
https://code.visualstudio.com/docs/customization/themes
Install theme from extensions from which you wish to start.
Then find where the theme got installed. On Windows it would be %USERPROFILE%\.vscode\extensions, see details in Installing extensions.
There you'll find folder with theme, inside is themes folder and <something>.tmTheme file which is actually xml file. Open it inside VSCode and start editing :)
You'll find items and colors, syntax is described elsewhere, but common sense will help you.
To test change, open desired .cs file in same editor. Changes are applied after restart, so it's also good to make key shortcut to restart the editor:
keybindings.json
...
{
"key": "ctrl+shift+alt+r",
"command": "workbench.action.reloadWindow"
}
...
Then try color, restart, see result, continue...
I'm trying to add Git support to my Visual Studio 2015 extension Diff All Files. I have everything working properly for the TFVC Team Explorer pages, and am trying to now have my extension show up on the Git Changes and Git History pages as well. In order to be able to detect the pending changes on the Git Changes page I need to get a handle to the IChangesExt service. This page shows how to do it, but for some reason it does not work for me; I always just get a null value returned back, and not the expected IChangesExt instance.
Here's the relevant code snippets from that site:
Microsoft.TeamFoundation.Controls.ITeamExplorer teamExplorer;
teamExplorer = base.GetService(typeof(Microsoft.TeamFoundation.Controls.ITeamExplorer)) as Microsoft.TeamFoundation.Controls.ITeamExplorer;
Microsoft.TeamFoundation.Controls.ITeamExplorerPage teamExplorerPage;
Microsoft.TeamFoundation.Git.Controls.Extensibility.IChangesExt changesExt;
teamExplorerPage = teamExplorer.NavigateToPage(new Guid(pageGuid), null);
changesExt = teamExplorerPage.GetExtensibilityService(typeof(Microsoft.TeamFoundation.Git.Controls.Extensibility.IChangesExt)) as Microsoft.TeamFoundation.Git.Controls.Extensibility.IChangesExt;
My code is slightly different, since my code executes automatically when the Git Changes window is opened I don't need to do the teamExplorer.NavigateToPage() call. Instead I use teamExplorer.CurrentPage, which I can see in the debugger is actually the Git Changes page (GitPendingChangesPageVS is the type), so I should be making the same calls as in the example from the site. Here's my code in the Git Changes page's Loaded() function. Notice that I try to get the IChangesExt service 4 different ways, but all of them just return null.
public override void Loaded(object sender, SectionLoadedEventArgs e)
{
base.Loaded(sender, e);
// Find the Pending Changes extensibility service and save a handle to it.
var service = this.GetService<IChangesExt>();
var teamExplorer = this.GetService<ITeamExplorer>();
var service2 = teamExplorer.GetService(typeof(IChangesExt)) as IChangesExt;
var service3 = teamExplorer.CurrentPage.GetExtensibilityService(typeof(IChangesExt)) as IChangesExt;
var service4 = teamExplorer.CurrentPage.GetService<IChangesExt>();
...
}
Any ideas what I am doing wrong?
The extension is open source, so if you like you can download the source from here (make sure you get the GitInitialFunctionality branch) and take a look. The relevant code is in the GitChangesSection.cs file.
I have also posted this question on the MSDN forums in hopes that maybe someone who frequents those forums can help me.
Any suggestions are appreciated. Thanks!
I found the source of the problem. I just noticed that everything worked fine in VS 2013, but not in VS 2015. After checking my references I see that I had my VS 2015 project referencing the 2013 (v12.0) Microsoft.TeamFoundation.Git.Controls.dll, which is the assembly that contains the IChangesExt interface. I added the VS 2015 (v14.0) version of the dll to my solution and changed my VS 2015 project to reference it, and now it is working as expected :)
I'm writing a Visual Studio editor plugin. I'd like the editor to behave similarly to other editors: if the edited file changes outside the IDE, I want the proper dialog window to be displayed and the document reloaded (if needed).
The IVsPersistDocData interface contains methods IsDocDataReloadable and ReloadDocData, but during debugging, they were never called in this scenario.
There is a combination of IVsFileChangeEx and IVsFileChangeEvents interfaces, but reaction to changing files outside the IDE seems to be so generic, that I guess I shouldn't need to manually monitor the edited file. Or should I?
It seems, that there actually is no automatic mechanism for doing that and using IVsFileChangeEx and IVsFileChangeEvents seems to be the only solution.
http://blogs.msdn.com/b/dr._ex/archive/2005/11/01/487721.aspx
http://msdn.microsoft.com/en-us/library/Microsoft.VisualStudio.Shell.Interop.IVsFileChangeEx.aspx
I'm using MS Visual Studio Pro 2012 and I want to create some kind of help file.
I was thinking in create a html file like this but my question is: Do I need to have the html file always in this directory, even after I have the .EXE file created or the html file is added to the .EXE file?
If not, how can it be done?
[.NET Framework 4.5 | Windows Forms]
EDIT : I want to load a given (local) html file in the default web browser. This file should be 'inside' the .EXE file.
If you're looking to build a help file from Visual Studio, why not look at:
http://shfb.codeplex.com/
Sandcastle will build your help file based on the comments you have written on your classes and methods. Hit the forward slash three times (e.g. /) above your class or method declaration and the comment box will appear. Populate with salient details, run Sandcastle, and your help file will be generated.
The advantage of having a separate HTML file is that you can update it on it's own without pushing out a new assembly. However if you want to build it into the EXE, you can go to your project properties, then click on Resources. Add an existing file (your HTML file) and it will now be accessible from your code.
When you want to open it you can do something like this
string html = Resources.MyHelpFile;
if (!File.Exists("tmpHelp.html"))
{
using (var tmpFile = File.CreateText("tmpHelp.html"))
{
tmpFile.Write(html);
}
}
Process.Start("tmpHelp.html");
You can then delete the help file at a later stage such as when the user closes your application.
I'll recommend using HTML Help Workshop to create the help file. and then use Help.ShowHelp();. Its a lot more easier
But for your case. You can either do as KeyboardP suggested or move the file to your bin/Debug folder and then use
Process.Start("helpname.html");
NOTE : You'll also need to add the file to the Application Folder when you're creating your setup.
You can build html file (I think the most easy way it's to create it via microsoft word and to save as html)
Then you make a new form contain webBrowser tool and set the URL to your html file path, like this:
string filepath = Environment.CurrentDirectory + #"\Help.htm";
Uri uri = new Uri(filepath);
webBrowser_Help.Navigate(uri);
My issue is: during Debug Mode in Visual Studio I can not see property name and it value. Any suggestions? UPD This bug/feature is reproducible in college PC.
UPD(15.06.2012)
The base class is placed to separated lib. Base class is abstract. And... Two times Debug was working fine, after making changes in source file (in screen-shots) and then running the project.
Please notice that Immediate window can not evaluate this expression.
MailProcessingViewModelContext inherits that base class that I have mentioned in the top of UPD.
It's a bug in Visual Studio that's caused when you scroll through the properties list with a mouse. Click the down arrow at the bottom of the menu instead.
As somebody on top already mentioned, you need the debugging symbol files (.pdb's) for every dll that you are using which is not your code, otherwise VS can't look 'inside'.
and if it's obfuscated you won't see anything at all
This would happen if you were debugging an ASP.NET wizard and wanted to check a collection of something, all elements in the collection that are in the current wizard step (current context) would be visible while the others are there but not in context just now hence marked as questionmarks -> ?
Maybe it could be something like that in your case. I guess it could be the same scenario
For me, this happened when I had a getter property in a class model pointing to itself. It was a copy paste error, notice the property name is ShouldNotProcess, and in the getter it's returning itself. The return was supposed to be: return !this.ShouldProcess;
public bool ShouldNotProcess
{
get { return !this.ShouldNotProcess; }
}
Are you trying to debug your own code or someone else's?
If it's not your code, the code has probably been obfuscated so you cannot see the private members or use reflector to reverse engineer it.
This also might happen if you're using a trackpad to scroll through the member list. Try using the keyboard instead.
You cannot access these menu items or display these windows in design mode. To display these menu items, the debugger must be running or in break mode.
REF:
http://msdn.microsoft.com/en-us/library/bhawk8xd
Is there a possibility that the object you are referring to belongs to another project (library template) and you added it as a file reference and not project reference?
Please share the details about the structure of the projects in your solution. Also the location of the class you are trying to access.
Make sure you're running in debug mode, I know I'm probably stating the obvious there. Also, check that expression you're evaluating - is it right? Are you casting to the right object. Finally, is the assembly that contains the class you are looking at included as a project in the solution, or just referenced as an external assembly? Make sure it's part of the sln.
If it's recreatable on another copy of visual studio then I'd guess it's not a problem with Visual Studio, but the object you are looking at.
Not sure if this is the case in your situation, but here is a post with a similar issue. Hope it helps