.net

How to use Deblector?

I am working with a 3rd party framework, and the code is pretty bad, and I'm getting exceptions that I can't figure out. I was able to decompile using Reflector, and now I'm trying to debug using Deblector, but I can't even figure out how to get a breakpoint set. Why is there no documentation for this tool? There is nothing available abo...

How to validate this scenario in ASP.NET MVC?

First, a little bit of context (cause I know you all love it!): I have a model called Note. It has a field called Type which, in the database, is an integer value that designates which type of object this note belongs to (1 = Customer, 2 = Sales Lead, etc). A second field called Source designates the ID of the specific object that this ...

UNC Virtual Folder

I would like to expose some service functionality as a virtual file share to allow conventional applications to use the virtual folder as a real one. For example, a file path consisting of \\\\Server\VirtualShare\File.ext means that VirtualShare doesn't really exist and only available as long as my service is running. A file access wi...

Wrong App.config being loaded

Hi all, I have a .NET 3.5 class library I built that reads an App.config file for values it needs. It can pull the config values just fine when I test it in Visual Studio. To test it, I just change the project to a console application and execute a method call. I have the need to call this class library from many other .NET programs,...

Is there any alternative to Application.DoEvents() for a web service.

Is there any alternative method to System.Windows.Forms.Application.DoEvents() to flush the event queue which doesn't use the System.Windows.Forms namespace? If not, is it ok to use the above method/namespace within a web service. ...

Use reflection to set a property value to Nothing (Null)

Edit: Based on the answer from LoveMeSomeCode, I believe this issue only appears in VB.Net. I'm trying to revert a class to a previous state by saving the old values of changed properties in a dictionary and setting them via reflection when I need to revert. I'm having a problem where if the old value is Nothing (null) I get a null refe...

Can I add a DataMember to a CollectionDataContract in WCF?

I have a collection class that I have decorated with a CollectionDataContract. The collection class also has a property on the class that I would like to be passed to the service client. I have tried adding [DataMember] to that property but it didn't add it to the class in the client when I updated. Any WCF experts out there have any ...

Bootstrapper Prerequisite ordering.

When using the generic bootstrapper with MSBuild how is the order of installation of prerequisite items determined? For example, given: <Project ToolsVersion="3.5" xmlns='http://schemas.microsoft.com/developer/msbuild/2003'&gt; <ItemGroup> <BootstrapperFile Include='A' /> <BootstrapperFile Include='B' /> <BootstrapperFile...

Looking for ASP.NET MVC PartialView and advanced AJAX documentation

I'm doing pretty well getting up to speed with ASP.NET MVC with the ASP.NET website walkthroughts and tutorials. Now I'm fully aware that this documentation is not complete and just Beta, but theres seems to be some important missing documentation. Where can I find the best information about the following topics (that seem to be lackin...

Checking null and string.Empty in C#

This might sound like a noob question, but are: string var; if (var == null) and string var; if (var == string.Empty) The same? Duplicate What's the Difference between String.Empty and Null? and In C#, should I use String.Empty or Null? ...

Using Reflection to get Method Name and Parameters

I am trying to workout a way to programatically create a key for Memcached, based on the Method Name and parameters. So if I have a method: string GetName(int param1, int param2); It would return: string key = "GetName(1,2)"; I know you can get the MethodBase using reflection, but I need the parameters values in the string not the...

NHibernate and a REST Service Layer

If ADO.NET Data Services (Astoria) adds a REST layer on top of Microsoft's ADO.NET Entity Framework, is there an equivalent project that adds a REST layer on top of NHibernate? ...

A framework type search tool for .NET

Does anyone know if such a tool exists? Online or offline? Basically I'm looking for a Google search indexer which only crawls over class names, field names and method names in the .NET framework assemblies (custom assemblies too would be great). This would allow for fast searching. I know Reflector has this search capability but it's no...

Generate a series of random numbers that add up to N in c#

How do I generate 30 random numbers between 1-9, that all add up to 200 (or some arbitrary N), in C#? I'm trying to generate a string of digits that can add together to be N. ...

How to run MSBuild from Powershell without spawning msbuild.exe process?

I am considering running MSBuild from a Powershell script by tapping directly to the MSBuild assemblies (as opposed to looking up MSBuild install path and starting msbuild.exe as a child process). Has anyone done this? What would be the simplest, most straightforward way to run the build? Are there any pros/cons to either technique you'...

Asp.Net MVC Route Table and Controller Actions

I am creating a directory of sorts with members and their profiles. I'm using the MVC framework in .net. I have a view that allows you to find members based on some criteria so my controller has a Find() action result, then another that accepts the post verb. So, somesite.com/members/find displays the search tools, then once the form...

How do I set tab size in the WPF RichTextBox

The WPF RichTextBox can be set to accept tabs in its input. It renders the result as a 4 character indent. I'd like to change that size. How can I change the default? ...

Smart Client Maximize a view in tab workspace

My question may not make sense but I have valid reason. We use .net smart client framework with CAB to develop window based application. We have a trend view (smart client view) which plots graph of live data. We use ProEssentials graph control for the same. Trend view is tabbed with a tab workspace. But the client want to maximize th...

Allocating unmanaged memory in managed .NET code

Hi I have a unmanaged function that takes a chunk of memory allocated by malloc and deallocates it later on in async manner. I want to wrap it into managed wrapper. Is following code OK? void managed_fx (byte data __gc[], size_t size) { // Pin the data byte __pin *pinned_data = &data [0]; // Copy data to the unmanaged buf...

MEF on Mono doesn't work properly?

I've made a very simple MEF sample which runs on .NET, but doesn't work properly on Mono. using System; using System.Collections.Generic; using System.Text; using System.ComponentModel.Composition; namespace Vialis { class Program { [Import(typeof(ILedController))] public List<ILedController> Controllers ...