|
Depending on what your application does you might be missing a library assembly (DLL) needed, especially if you are getting the exception when the program is loading. Check the dependencies on your development machine. (If you build a deployment package using VS these any assemblies your application depends on should be packaged in the MSI automatically.)
If that's not it you might try adding an application thread exception handler of your own in an effort to get more information on just what exception is being thrown. For example, in your Main method (but before Application.Run()):
Application.ThreadException += new ThreadExceptionEventHandler(ApplicationThreadException);<br />
Then a simple handler:
static void ApplicationThreadException(object sender, ThreadExceptionEventArgs e) {<br />
string msg = <br />
"A problem has occurred while running CAPA Facilitator:\r\n" +<br />
"\t" + e.Exception.Message + "\r\n\r\n" +<br />
"Would you like to continue running CAPA Facilitator so that\r\n" +<br />
"you can save your work?";<br />
DialogResult result = MessageBox.Show(msg, "Unexpected Error", MessageBoxButtons.YesNo);<br />
<br />
if (result == DialogResult.Yes) {<br />
return;<br />
}<br />
Application.Exit();<br />
}<br />
This will display the exception error message in a dialog befor closing the program, which could provide clues to what's going on.
Hope this helps.
Mitchell
|
|
|
|
|
I try to buikd a strong name signed assembly in Jscript.net.
I am using the following assembly level attribute:
import System;
import System.Resources;
import System.Runtime.InteropServices;
import System.Reflection;
[assembly: AssemblyKeyFileAttribute("keyfile.snk")]
JSC does not complain at all, but the resulting DLL is not signed with a
strong name. Actually JSC does not complain even if keyfile.snk is missing.
CSC does the above job just fine but I prefer Jscript.NET for various
reasons.
SDK version is 1.1
Any feedback appreciated.
Stefan Stefanov
XEROX systems analyst
|
|
|
|
|
I have four questions regarding the following MSIL.
1. If auto is used, the layout of this object in the memory is decided by the runtime. What happens if I do not use auto?
2. How does ansi keyword help in handling interoperability between managed and unmanaged code?
3. What is the use of cil managed?
4. What is the use of specialname, rtspecialname and instance?
.assembly DemoMSIL{}
.class public auto ansi HelloWorld extends [mscorlib]System.Object
{
.method public hidebysig static void HelloWorld() cil managed
{
.entrypoint
ldstr "Hello World."
call void [mscorlib]System.Console::WriteLine(class System.String)
ret
}
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
|
|
|
|
|
instance is used to indicate that the method is an instance method and not a static method.
Regards
Senthil
My Blog
|
|
|
|
|
|
To all,
Does anyone know how one can remove/reset the "Look In" history in the "Find in Files" dialog in the VS IDE? It is very annoying when I type in a wrong directory by mistake and it gets in the way forever.
Greatly appreciated.
|
|
|
|
|
I am using the openfiledialog in my project. Sample code: at bottom
I get a blank filename when I get a return back from the dialog.
This happens after I pick a file (any file).
Now when I run the same code on my other computer (laptop), it functions normally. What can cause this to happen?
I am not having any other system problems (that I know of), and this is really wierd.
Any ideas? (Framework 1.1) xp servicepack 2 ( I think I am fully upgraded software wise.)
If ofd.ShowDialog() = DialogResult.OK Then
'Load the excel import file into a datatable
PartsTrakCommonLibrary.PartTrakCommonLibrary.FillDataTableFromExcel(dtImportData, ofd.FileName)
End If
Thanks,
Foxjazz
|
|
|
|
|
Hi,
I had the same problem when I tried to preload some C-Dlls before the main window was shown.
When I loaded them after showing the first window, it worked fine.
hope that helps.
Good luck, klawipo
|
|
|
|
|
Anyone know of a free DLL reader. I have a dll that the company used back in the day and no source is available.
The programmer is no longer with company. Grrr.
Thanks is advance.
*****************
"I know how hard it is for you to put food on your family." —GW
|
|
|
|
|
For .Net-Assemblies there is the .Net Reflector, available e.g. at
http://www.aisto.com/roeder/dotnet/
If you're lucky, this tool may show you the complete source code.
For unmanaged dlls you can use the old dependency walker,
probably available somewhere at microsoft.
This tool can only tell you about exported functions and types.
tell me if this helped.
Good luck,
klawipo
|
|
|
|
|
The .NET TextBox control automatically provides a nice context menu that pops up when the user right-clicks in it with all the stuff expected, like Cut, Copy and Paste (and some surprising ones, like right-to-left selection, etc.). However, if you add a context menu component of your own you lose the one provided. Does anybody know a way to find and merge with the default menu? I've been trying to add an item to call a spell checker I've added to my project and don't want to have to duplicate all of the nice things the TextBox already provides on its default context menu... Any thoughts?
Thanks in advance for any help!
Mitchell
|
|
|
|
|
hi dear i am facing the same have u any solution now.
please reply me pankajupadhyay29@gmail.com if u can
|
|
|
|
|
Hi, Does anyone know if the memory functions in the Process class return bits or bytes or what? I'm using the methods to get a Process's memory it's not giving me the same amount as shown in taskmanager. For instance the process for the program I created returns these ints with these functions which don't seem to match up with task manager.
{Returns} {Function Called}
Physical Memory: 20586496 (WorkingSet)
Min Physical Memory: 204800 (MinWorkingSet)
Max Physical Memory: 1413120 (MaxWorkingSet)
Non Paged System Memory Size: 24832 (NonpagedSystemMemorySize)
Paged Memory Size: 10211328 (PagedMemorySize)
Paged System Memory Size: 71868 (PagedSystemMemorySize)
Peak Paged Memory Size: 10211328 (PeakPagedMemorySize)
Peak Virtual Memory Size: 194551808 (PeakVirtualMemorySize)
Peak Working Set: 20701184 (PeakWorkingSet)
Virtual Memory Size: 194506752 (VirtualMemorySize)
Taskmanager shows
Mem usage: 30,624K
Peak Mem usage: 30,632K
VM size: 19,104K
Paged Pool: 69K
NP Pool: 23K
|
|
|
|
|
The values returned by those functions are snapshots, they don't change dynamically.
Regards
Senthil
My Blog
|
|
|
|
|
I realize they are shapshots, I took the readings of both at the exact same time, the amount of memory used is not changing. The problem is none of the functions in .NET seem to give me the same amount of memory Windows Taskmanager does. I checked it for all processes running on my machine, and taskmanager gives different results then .NET every time for me.
Thanks
|
|
|
|
|
Hi, I have the following problem:
I need to set the property of a child control of a form, but from an external form. The truth is i have no idea on how to procced to do this,
- do I need to make the owner form aware of the event occured in the external form in order to reflect the change? (change this property)
- or somehow i can refer to the the instance of the owner form from the external form so i can change this property?
Either ways i dont know how to do this, as you can see I'm lost
PS: I've asked on many forums and newsgroups and noone replies me!, I'm hoping for some codeproject geeks to show up
|
|
|
|
|
please tell me . microsoft visio 's document where store the all information of document. like if i give custom properties of document where it save internally . can i see it witout open visio and other property who create it
.is it save any table
freetoyoula
|
|
|
|
|
I have been beating myself up over trying to locate what I thought was a memory leak in MY code but based upon what I have seen I can't be sure that it IS my fault or something strange with DOTNET. Someone here please feel free to enlighten me on this one.
The code to reproduce is very simple. Done in VB.NET (please no language based flames here - I am already working up a C# version just to be safe ) , One form with a button on it called cmdStart. Here is the code behind the form:
Public Class Form1
Inherits System.Windows.Forms.Form
Dim t1 As System.Threading.Thread
Dim t2 As System.Threading.Thread
Dim t3 As System.Threading.Thread
Dim t4 As System.Threading.Thread
Dim t5 As System.Threading.Thread
#Region " Windows Form Designer generated code " 'This has been clipped out for brevity here
Private Sub ThreadWorker()
Do
Debug.WriteLine("Thread Enter. [" & System.Threading.Thread.CurrentThread.Name & "]")
System.Threading.Thread.CurrentThread.Sleep(1000)
Debug.WriteLine("Thread exit [" & System.Threading.Thread.CurrentThread.Name & "]")
Loop
End Sub
Private Sub cmdStart_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdStart.Click
t1 = New System.Threading.Thread(AddressOf ThreadWorker)
t1.Name = "T1"
t1.IsBackground = True
t1.Start()
t2 = New System.Threading.Thread(AddressOf ThreadWorker)
t2.Name = "T2"
t2.IsBackground = True
t2.Start()
t3 = New System.Threading.Thread(AddressOf ThreadWorker)
t3.Name = "T3"
t3.IsBackground = True
t3.Start()
t4 = New System.Threading.Thread(AddressOf ThreadWorker)
t4.Name = "T4"
t4.IsBackground = True
t4.Start()
t5 = New System.Threading.Thread(AddressOf ThreadWorker)
t5.Name = "T5"
t5.IsBackground = True
t5.Start()
End Sub
End Class
Now, you ask what the problem is here? It appears to me that there is a memory leak afoot.At least according to perfmon.
When I monitor the privateBytes for the test app running these threads and sample every 60 seconds I get a very definite memory increase shown.
My question here is WHY?!? My thread is not creating any resources unless you count anything allocated internally by the framework to perform the debug prints. I am testing this running debug build of the app and to be honest I have not tested a release build yet so I cannot comment on what those results are.
Now, keep in mind that my app is MUCH more complicated than this, but I am seeing the same results here as I am in my app. I thought originally that I was seeing some memory issues because I was creating a clone of a few hashtables inside my threads and I thought perhaps that was causing some GC issues but now I am not so sure. In fact when I ran my app with all the internals of the threads commented out except for the debugs and sleeps as I have here I still see the apparent memory creep.
Can ANYONE explain to me what I am seeing here?
Am I going nuts?
I have to admit that I am by no means a threading master yet but this seems pretty basic to me.
The even stranger part is that, while I am typing this in I happened to look at perfmon and see that it appears to have eventually leveled off after about 14 minutes. The memory appears to have gone from 6654720 to approx 7772000. That is a growth of 117280 bytes. Not allot but I still don't understand why the memory is growing. Can this all be explained away by GC? Seems a bit odd since I am not allocating anything in my app on a cyclic basis.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
I suggest you read Joseph Newcomer's excellent article How Big Is My Program?[^] Written for C++ apps, it still applies heavily to .NET applications.
The 'Mem Usage' column in Task Manager - which is the same as the 'Process: Working Set Size' counter in perfmon/System Monitor - shows the amount of physical memory currently allocated to your process. It's not quite that simple, though, as it includes all shared items (such as code in DLLs loaded into your process) that have been referenced recently.
The GC heap follows a fairly common pattern of making virtual memory allocations but not releasing those allocations back to the OS unless memory pressure or the amount of free memory is moderately high. This saves time in making allocations - altering the virtual memory map requires calls into kernel mode. So you'll tend to see the working set grow, in the general case.
Finally recall that a thread is not free. Memory must be allocated for the thread's user- and kernel-mode stacks and for any other per-thread data.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Mike Dimmick wrote:
I suggest you read Joseph Newcomer's excellent article How Big Is My Program?[^] Written for C++ apps, it still applies heavily to .NET applications.
Thanks for that.. I will be sure to check into it.
Mike Dimmick wrote:
The GC heap follows a fairly common pattern of making virtual memory allocations but not releasing those allocations back to the OS unless memory pressure or the amount of free memory is moderately high. This saves time in making allocations - altering the virtual memory map requires calls into kernel mode. So you'll tend to see the working set grow, in the general case.
yeah, I figured it might end up being something like this but I was ammazed to see it take so long. I ran an overnight test (7 hours) and did end up seeing where the memory was reclaimed after 6 hours. I just figured that GC would have an effect quicker than that.
Mike Dimmick wrote:
Finally recall that a thread is not free. Memory must be allocated for the thread's user- and kernel-mode stacks and for any other per-thread data.
I understand that as well, but what I did not expect to see was a memory creep up over several minutes then get release hours latter. I figured I would see an immediate increase in size right when the threads were created but not that I would ocntinue to see a creep up after that.
Thanks.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
so maybe my problem (couple threads up) is that .NET returns shared memory in use by a other processes. Does anyone know how to compute a proper amount of memory like taskmanager does?
|
|
|
|
|
|
Hi,
Can someone tell me the way by which the 'obj' directory created to store temporary files in the .NET framework Ex.
%Project Directory%\obj\<configuration>
Can be changed to some other path.
Since the output directories can be changed from the properties page of the project, but is there any similar way by which the 'obj' diretory path can be changed
Appreciate all the help
Saleem
|
|
|
|
|
was trying to do this.
1. Spawn cmd.exe and have a dialog with it sending commands to it and getting the output.
I did all the relevant things . All those properties and things , But I cant read the output , or I think the process exits itself. The code I am trying is given below.
2. I was trying to spawn bitsadmin.exe with the argument /list but got this error .
BITSADMIN version 2.0 [ 6.6.2600.2180 ]
BITS administration utility.
(C) Copyright 2000-2004 Microsoft Corp.
Unable to get console input mode - 0x80070006
The handle is invalid.
// This is the the code I am using to try it out.
private void button1_Click(object sender, EventArgs e)
{
Process p = new Process();
ProcessStartInfo pInfo = new ProcessStartInfo();
pInfo.RedirectStandardOutput = true;
pInfo.RedirectStandardError = true;
pInfo.RedirectStandardInput = true;
pInfo.FileName = "bitsadmin.exe";
pInfo.Arguments = "/list";
pInfo.CreateNoWindow = true;
pInfo.UseShellExecute = false;
p.StartInfo = pInfo;
p.EnableRaisingEvents = true;
p.OutputDataReceived += new DataReceivedEventHandler(process1_OutputDataReceived);
p.ErrorDataReceived += new DataReceivedEventHandler(process1_ErrorDataReceived);
p.Exited += new EventHandler(process1_Exited);
p.Start ();
//p.StandardInput.WriteLine("dir");
}
private void process1_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
this.Text = "process1_OutputDataReceived";
textBox1.Text += e.Data + "\n";
}
private void process1_ErrorDataReceived(object sender, DataReceivedEventArgs e)
{
this.Text = "process1_ErrorDataReceived";
textBox1.Text += e.Data + "\n";
}
private void process1_Exited(object sender, EventArgs e)
{
this.Text = "process1_Exited";
Process p = sender as Process;
textBox1.Text += p.StandardOutput.ReadToEnd() + "\n";
}
}
|
|
|
|
|