.net

How do I emit code and inject it into a loaded assembly?

I've built some Types dynamically using System.CodeDom.CodeCompileUnit, want to compile those into IL code in memory, and inject that IL code into an assembly loaded in memory - there is no need to save any of this to disk. Maybe my stated plan is wrong. Open to other suggestions about how to get that CodeCompileUnit instance to the said...

Strange behaviour with mouse hook in .net, winforms

I have a form that is displayed, not by ShowDialog, but by setting it's visible property to true. This is so it behaves like a dropdown. The form installs a mouse hook, using SetWindowsHookEx(WH_MOUSE, ...) I detect if the mouse is clicked outside of the dropdown and if so, return 1 in my HookProc method and close the dropdown. The st...

Fluent NHibernate, varbinary(max) and SQLite

Hi, I have a varbinary field in my sql server database that needs to be varbinary(max). I create my database with NHibernate and I use Fluent Nhibernate for my mappings. I also use SQLite for my unit tests, I use the same mappings I just change the configuration before creating the database in memory. I get the following problem. I c...

How to debug through .NET Framework source code?

This question was asked before... but a while back.. and perhaps someone found a solution. Has anybody been able to debug through .NET Framework source code after installing VS 2008 SP1? I can't get VS to download the source code (although I'm able to download .pbd files) ...

How can I build Application.UserAppDataPath inside class libraries (that don't have an Application object)?

Winforms and Console Applications can use Application.UserAppDataPath. What if I want to build the same path from a dll? How can I do that? I know that Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) would be the start... ...

aspnet_regsql - Creating the Application Services Database for mysql or postgresql database

Hello, I know that it is possible (and straightforward) to create an application services database using a SQL Server database. However, I would like to use another database technology such as MySQL or PostgreSQL for my authenticaton/role management. I was wondering if there is a similar command to do so for non-mssql databases or if the...

Window is not maxinizing/being brought to front after being in tray, why?/help

I wrote an alarm app with some complex code i dont feel like breaking up right now to use as an example. I have a timer checking every 10 or so minutes about a state online and on certain conditions my app alerts me. On form_load i set the timer to 10mins and when it triggers and the condition is true i call a function with this in it. ...

I want to edit my xml file

Hi I am working on XML file, here I want to give rights to user to edit my xml file nodes to his own custom language. I am enclosing my code, but it is not editting my xml file. Need assistance. class Program { static void Main(string[] args) { //The Path to the xml file string path = "D://Documents and Setti...

Redirect to error page

I want to use Response.Redirect to redirect the browser when an exception occurs. I also want to pass the exception message to my error page. For example: string URL = "Page2.aspx?Exception=" + ex.ToString() Response.Redirect(URL) Can it be done? Is this the right syntax? ...

Utilizing less memory in ASP.NET

My asp.net application is 3 static pages (no database) and it initializes with 48Mb of memory in use. Can I configure the application to use less memory? NB: I've already set the memory limits in IIS. I set maximum value for working process to 30 MB of physical memory. What other ways can I employ to make ASP.NET use less memory...

WCF sending big files

I'm writing a WCF service which will be used to receive big files (mp3 files and others), process them and then return an mp3 audio file. I don't want to save those files in the filesystem, I'd just like to process them, and then return an audio file. the problem is I'd like the process to use as low memory as possible. how would I acco...

How to implement correlation ID in Windows EventLog with .NET?

Hello, we are about to start using EventLog as our Centralized Auditing solution. A problem I am facing right now is recording correlation of log entries. For example we have operation that starts in one component and ends in another one. This operation has unique ID. So I need to correlate entries with Operation ID. How to store this ...

Unable to deploy a simple WCF - Get the "The resource cannot be found"

I created a very simple WCF and deployed it to the hosting provider by doing a "Copy Website". Locally, it's setup to use the development server (not in IIS). The domain is under Full trust permissions. Locally, I can get to the Service.svc page, but not in the hosting provider. The code is as follows: Service.svc <%@ ServiceHost Lang...

Unity constructors

I have setup unity in my project and it is working for objects that don't have constructor injection implemented on them. The issue is now I do have an object which requires a custom object as a constructor argument. I have set up the config below, and this errors telling me that "TypeConverter cannot convert from System.String" <unit...

Localization problem

I need to make a form that have to suport two languages (for now). the two languages dont have the same look and also half of the form is not a like but it still have some similiarity beetwen them. what is the best way to deal with this problem in a case of two different languages and above? by the way, the program language that I use is...

How to select records from SQL DB that contain the same ID as a .NET datatable records

I'm loading a CSV file containing many thousands of rows into a .NET DataTable that looks something like this: MyLocalDataTable SequenceNo, Etc I have a table in an SQL database and I'd like to pull records into another datatable based on what I find in the CSV file. MySQLBDTable IdentityID, SequenceNo, Etc The SequenceNo is my...

Extracting text from a PDF file.

I'm using PDFBox for a C# .NET project. and I'm getting a "TypeInitializationException" (The type initializer for 'java.lang.Throwable' threw an exception.) when executing the following block of code : FileStream stream = new FileStream(@"C:\1.pdf",FileMode.Open); //retrieve the pdf bytes from the stream. byte[] pdfbytes=new byte...

speeding up windows file search with C#

i made a program that search logical drives to find a specific file .if user type file name an click search button , searching begins , but i don't know how to stop searching in the middle of process.can you help me ? ...

Unzipping ZLIB compressed portions of a binary file

Hi All- I'm reading a file(a flash swf) from .Net 3.5 that has a header which states whether the body of the file/Stream is compressed or not. However, I'm having problems-after I rewrap the basic File stream in a GZipStream, I get an exception stating that "The magic number in GZip header is not correct. Make sure you are passing in a...

RAM memory reallocation - Windows and Linux

I am working on a project involving optimizing energy consumption within a system. Part of that project consists in allocating RAM memory based on locality, that is allocating memory segments for a program as close as possible to each other. Is there a way I can know where exactly is the position of the memory I allocate (the memory chip...