.net

How do make a field be debug-only in C#?

I'm having trouble the same instance of a C# class being used in multiple places. I'd like to be able to tell at a glance in the debugger which instance is which, so I've added a field called DebugUID like so: public readonly string DebugUID = Guid.NewGuid().ToString(); and I've also added the attribute [DebuggerDisplay("DebugUID= {D...

.NET - Workflow, End-User Diagrams, Reflection

Are there any tools which can reflect over Windows Workflow or SharePoint Workflow assemblies and generate a .png or some other image type to present to a user? Dynmically via ASP.NET? Or if there isn't anything like this... how do you provide documentation / end-user documentation? I would be interested in free or non-free tools. ...

C# compile error: "No logical space left to create more user strings"

I am trying to compile a one-off "script", an autogenerated C# program. This program contains 120,000 different string literals. The C# compiler can't build this, saying: Unexpected error writing metadata to file '<removed>' -- 'No logical space left to create more user strings.' Is there a hard limit in .NET on the number of string l...

The .NET SDK Programs - What does each tool do?

My question is simple. What do they do? The accepted answer below is a list of the .NET SDK Tools that come in the framework. ...

Spellchecker for windows forms in .NET

I am looking for a third party component that could handle spellchecking for Windows forms (.Net 2.0 or .NET 3.5) I have the following requirement: 1) The component should be able to use Open office dictionary (Need to use a Swedish dic I think the OO is the best one) 2) Be able to underline in the UI while typing, like word. (Don’t w...

How to host an IronPython engine in a separate AppDomain?

I have tried the obvious: var appDomain = AppDomain.CreateDomain("New Domain"); var engine = IronPython.Hosting.Python.CreateEngine(appDomain); // boom! But I am getting the following error message: Type is not resolved for member 'Microsoft.Scripting.Hosting.ScriptRuntimeSetup,Microsoft.Scripting, Version=0.9.0.0, Culture=neutral, Pu...

Should I unit-test my view in MVP(or VM) or how to keep the code in the view to a minimum?

I use Model-View-Presentation Model in my application and I am wondering whether I need to create unit tests for the view. (I am on .net 2.0 WinForms) Now typically the view should be so simple that it should not be necessary to create unit tests for it. At least that's the idea I got from the goal of having the separation of View vs. ...

How to properly unit test calling UI method on another thread?

Having coded an extension method (based on http://stackoverflow.com/questions/723532/gui-update-when-starting-event-handler-class-on-separate-thread/723584#723584): public static class ControlExtensions { public static TResult InvokeEx<TControl, TResult> (this TControl control, ...

Is there a way to get a type's alias through reflection?

I'm writing a simple code generation application to build POCO's from a DB2 database schema. I know it doesn't matter, but I prefer to use type aliases rather than the actual system type name if they are available, i.e., "int" rather than "Int32." Is there a way using reflection that I can get a type's alias rather than it's the actual...

How to strip characters between HTML tags

I have the following HTML: <h1>Text Text</h1> <h2>Text Text</h2> I am still trying to get a handle on regular expressions, and trying to create one that would eliminate the spacing between the tags. I would like the final result to be: <h1>Text Text</h1><h2>Text Text</h2> Any help would be greatly appreciated! UPDATE I wou...

Exception in Excel 2007 operation on Vista

Hi, I have developed an console application in C# .net which creates a new excel & performs some operations in it [Interop]. I have added Interop.Microsoft.Office.Interop.Excel.dll as reference in my project The code works fine on XP & in Vista too. But if i keep my exe in one of the folder then it gives me excception Retrieving t...

Properly locking a List<T> in MultiThreaded Scenarios?

Okay, I just can't get my head around multi-threading scenarios properly. Sorry for asking a similar question again, I'm just seeing many different "facts" around the internet. public static class MyClass { private static List<string> _myList = new List<string>; private static bool _record; public static void StartRecordin...

Passing Data to Custom Windows Service

I am developing a custom Windows service with C# that will manage state for several instances .NET applications. How can I pass data (such as token) to the service through the ServiceController? Is this possible or am I not fully understanding the design intent behind Windows services? ...

Regex expression challenge

Can somebody put a regex expression that will: find a chunk that starts with [% and ends with %] within that chunk replace all xml special characters with: & quot; & apos; & lt; & gt; & amp; leave everything between <%= %> or <%# %> as is except make sure that there is space after <%# or <%= and before %> for example <%=Integer.Max...

.NET Publisher Certificates

I'm using a book for studying for .NET certification, and I'm stumped on the issue of publisher certificates. Background: Windows Vista Home Basic SP2 Visual Studio 2008 .NET 3.5 SP1 Goal: Write a simple C# console application that has its permission to read from a specific text file determined by the application's certificate. Symp...

What to learn first - C++/STL/QT or .NET/C# - if I have limited time while learning and working?

I am currently a CS student at a 4th year(of total 5). I`m studying and working. At work I use ASP.NET. So, while working and studying, I have not so much time to learn new languages and techniques. What do you suggest to learn first - C++/STL/QT or C#/LINQ/WPF? I mean, C++ and its libraries are stable and do not change as fast as .NET t...

Signing .net assemblies: Is it necessary and what does the added cost get me?

I have an assembly written in .net 3.5. I distributed this file to a bunch of people and so far, no problems unless they try to load the assembly (a dll) from a network share. Then they get security exceptions but this is easily fixed by changing zone security of the local intranet. Currently I am not signing my code with any form of ce...

What is the proper way to reference Embedded Resources in .net xmldoc comments?

I have a C# project that uses xml comments. I make chm files from them with Sandcastle via the Sandcastle Help File Builder. One of the member functions in this project makes use of an embedded resource. I want to reference it in the help file. It seems that sandcastle does not support this, but the xml documentation files it parses does...

Reload Environment Variables in C# after launch

We received a new code base that uses environment variables all over the place. They point to things like the project root, assets, different tools, etc. Not the most ideal situation but it works. However, when it comes time to try and run our automated build it becomes a giant pain. Windows seems to instance the environment varia...

Scroll tab with the up and down keys (vb .net)

I have a tabcontrol with several tabpages. I would like it so that when I hit the up or dowm key, the selected tab page scrolls. Im just not sure which event that would be. Thanks ...