.net

Problems invoking methods on a COM thread from a WinForms GUI thread?

I'm having trouble with my COM component written in .NET throwing warnings that look like: Context 0x15eec0 is disconnected. No proxy will be used to service the request on the COM component. This may cause corruption or data loss. To avoid this problem, please ensure that all contexts/apartments stay alive until the app...

Unassigned local variable in one time of several?

I have next code: static void Main(string[] args) { byte currency; decimal amount; if (Byte.TryParse("string1", out currency) && Decimal.TryParse("string2", out amount)) { Check(currency, amount); } Check(currency, amount); // error's here } static void Check(byte b, decimal d) { } and ge...

Splitting Word Documents Into Smaller Ones

I want a user to be able to upload a word document and my program then parses the document into separate word documents. The problem is that the splitting will need to be manual as all the word documents are not formatted the same way. My initial thought is before the user uploads, the user tags the sections with a beginning and end tag ...

Help in creating Enum extension helper

Take this enum for example: public enum PersonName : short { Mike = 1, Robert= 2 } I wnat to have en extension method like this: PersonName person = PersonName.Robert; short personId = person.GetId(); //Instead of: short personId = (short)person; Any idea how to implement this? it need to be generic to int, short etc...,...

Make window always stay on top of ANOTHER window that already stays on top?

How can I make a window always stay on top of another window that already always stays on top? Not that it has to stay on top of all other windows, I just need it to stay on top of a particular window. ...

vb6 and vb .net interop on vista 64 versus windows 7.

I have written a .net dll that I can successfully call from vb6. Deployment to xp, vista 32, and vista 64 boxes have been working. It is not working on windows 7 64 bit. I cannot run regasm.exe /codebase name.dll on the end users machine because they are not admins. Any ideas on helping me with deployment would be greatly appreciated...

Enterprise Library Configuration and .NET 4.0

I have a class library created in .NET 4.0 When I use the Enterprise Library Configuration tool to load this assembly, I get: Error loading assembly: Could not load file or assembly. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. I have tried the Configuraiton tool in both the Enterpri...

Is SharedCache ready for production?

I've been comparing distributed caching solutions for an ASP.NET environment and would like to use something FOSS if possible. I've come across SharedCache and seen it recommended by a few people on StackOverflow. Has anyone actually used this in a production environment? I can't find much online about the maturity of this project and...

Accessing top master page properties in a nested master page code behind

I have a nested master page that has its own master page. The parent master page has a property defined in its code behind. Public ReadOnly Property SelectedPage() As String Get Return _selectedPage End Get End Property How can I reference the parent master page's property from within either the child master page's c...

Why is .NET unable to decode this string when Java can "Hi%E1" ?

My problem is with .Net Http/Uri libraries not being able to decode or unescape this character sequence: "Hi%E1". Neither Uri.UnescapeDataString nor HttpUtility.UrlDecode can do it. Although I have a solution to get around this problem ( http://stackoverflow.com/questions/1221849/url-decoding-confusion ) I would like to understand why ...

MSBuild - Set Properties For Solution

We are using .NET 3.5 with VS2008. I have a solution with ~20 projects in it, and that number will grow over time as the application grows and adds new modules. Today I needed to set a property on every project. I had to edit each csproj file to add the following: <Target Name="BeforeBuild"> <CreateProperty Condition=" '$(Solut...

The Definitive Tail-Call Recursion Question

After participating in the debate in this fiascoquestion, I would like to posit the question before the entire community. In what scenarios will tail-call optimization be applied to .Net-based code? Please support your answers with reliable, up-to-date sources or reproducible experiments. ...

HTTP Request with multiple Ranges

Hi everybody, if I want to partially download a file and define a single range in the request Header, I get the byte-stream of the requested file in the response body. But if i specify multiple ranges as below, I always get for each defined range an additional response header (wich describes the requested range) within the response bo...

Json Deserialization to Dictionary .NET

Given json like this: [["Rating (out of 5)","3"],["Date taken","Mon, 03 Mar 2003 03:04:03 GMT"]] What is the best way to deserialize it into something like Dictionary<string, string> or should I be using a different data structure? I'd probably prefer to use the .net Serializer but will consider other options if this wont work. ...

How to find cause and of the SocketException with message that an established connection was aborted by the software in your host machine?

Hi All, I know the similar question may have been asked many times, but I want to represent the behavior I'm seeing and find if somebody can help predict the cause of this. I am writing a windows service which connects to other windows service over TCP. There are 100 user entities of this, and 5 connections per each. These users perfor...

Trace.WriteLine in release mode?

And what is the main difference between Trace.Write and Debug.Write? Thanks! ...

How to represent Unicode characters in an API

This is more an MBCS question than a Unicode question. I need to create an API that returns a list of structs that each instance holds a Unicode character as one of its members. This is in .NET so you'd think I'd want UTF-16, but then for Asian characters, there'd like be two characters required. What's the best practice when returnin...

Visual Studio Web Application edit source while running like in Tomcat\Eclipse\Java

In an ASP.NET Web Site project, I've always been able to make changes to the underlying C# code and simply refresh the page in the browser and my changes would be there instantly. I can do the same thing when working with Java and Eclipse - edit my Java source and refresh the page and my changes are there. I cannot do this in ASP.NET M...

Override default text for derived Windows Form control

When you drag a new Button onto a Windows Form it is automatically assigned the text "button1". If you have a control that inherits button called "CustomButton" then that one is automatically assigned the text "customButton1" when added to a form. Is it possible to make this text default to something else? For example, can I have the te...

Why do I get assembly bind failure in IIS CGI program

I have a C# program that is running as a CGI app in IIS on XP Pro SP3. It runs fine until I reference a library assembly class and use it in the program's code. If I run the CGI program by hand it loads and executes. But when it is run by IIS the referenced assembly fails to bind despite it being right in the same directory as the parent...