|
Visual Studio NET is an Integrated Development Environment - an environment that supports creating applications by providing graphical tools, debugging facilities, project management tools etc.
The NET framework is a family of classes that provide libraries of functions that provide the foundation of the programs you create using NET languages.
The NET framework is an integral part of any application you create. Visual Studio is an environment that assists you in creating those applications.
|
|
|
|
|
Thanks-- that was an excellent explanation...
|
|
|
|
|
Example in psudocode
new myHugeObject HugeObject();
.....
myHugeObject = null; //no GC between this statement and the next
fixed int i;
//CLR calls garbage collection here
In this case will any more memory actually be made available to the application (would require a c/c++ style linked list style heap), or will all the memory freed from MyHugeObject and any other GCed variables be unavailable until i goes out of scope?
I'm assuming it would be the latter, in which case prior to allocating fixed variables with long lifetimes might be one of the handful of exceptions to the general rule against forcing manual GCs.
|
|
|
|
|
The CLR uses a special large object heap to handle large objects, so doing a collection probably wouldn't have the effect you are expecting.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
Forgot about that. I'm more interested in the behavior of the GC itself than in a particular circumstance that would cause it though. modified example.
//allocate lots of small-medium sized objects, and release them all at once (ie stuff them into a container, etc)
fixed int i;
//CLR calls garbage collection here
If the CLR is smart enough to do a GC before creating fixed variables this wouldn't matter, but if the freed objects were around long enough to become Gen2 and needed finalizing there'd be a major performance hit in a potentially unneeded call, so I doubt it would.
|
|
|
|
|
In your example, you're creating an int32 after you allocate and release a large number of objects. AFAIK, in the IL code thats generated, the space for the int32 value type is allocated at the beginning of the method its declared in, not when your code specifies its creation, I THINK! I haven't verified this with a test though...
If this is indeed the case, your question isn't valid because it describes a situation that never happens.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm not sure how it would affect it. Probably the best way to figure it out is to fire up windbg and sos to see where all the allocations are.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
I don't think having fixed variables affects collection of other objects. The GC walks the heap and traces roots to those objects. In your case, if the GC happened at the point you indicated, then it will notice that HugeObject has no outstanding references and hence will garbage collect it.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
You've misunderstood my question. My concern was that the fixed variable would be placed after HugeObject in memory. Since the fixedvar can't be moved, freeing HugeObject wouldn't actaully provide any more memory to be used without the memory manager using a freelist type structure to allocate memory in the space between the nonGCed objects and the fixedvar.
|
|
|
|
|
dan neely wrote:
My concern was that the fixed variable would be placed after HugeObject in memory
No, it wouldn't. HugeObject would end up on the Large Object Heap. Your int would not be allocated on the same heap.
Also, fixed can only allocate pointers. You can't use it to allocate an int , but you can use it to allocate a pointer to an int . In order for the pointer to be valid, the fixed statement pins the target of the pointer so the GC can't move it. Once the fixed statement is no longer in scope, the pinned object is released.
Point pt = new Point();
fixed ( int* p = &pt.x )
{
*p = 1;
}
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
In client and server environment. My client make a request to the server, then server need to create a new Appdomain object "ad", then create an object "so" from this new Appdomain for client to use, My questions are:
(1)How to create a new channel and register this server object "so" in the new domain, I went through all the Appdomain class members, still don't have a clue.
I am thinking to use "ChannelServices.RegisterChannel(new IpcChannel(portName))", but how to associate this to new Appdomain object "ad" or "ad" event(I am guessing)?
(2)If (1) succeed, how I let my client know or pass the reference of new registered object to the client since client won't be able to know the channel information in advance?
You help is highly appreciated!
Hang
|
|
|
|
|
sir, i'm learning vb.net,c#.net in a institute.
can i got a job with 50,000(Rs.) salary or is there any wanted.
i want to do my project in .net
write me any concept
|
|
|
|
|
Anonymous wrote:
sir, i'm learning vb.net,c#.net in a institute.
Good
Anonymous wrote:
can i got a job with 50,000(Rs.) salary or is there any wanted.
That's about US$1,104 a year. It sounds like you're worth it.
Anonymous wrote:
i want to do my project in .net
Good
Anonymous wrote:
write me any concept
You sound like a real candidate for www.rentacoder.com. They get people with little skill in the third world, and pay them badly, to write bad code. You should check it out.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I've developed a simple C# program (for PocketPC), and It sometimes crashes with an unhandled exception... and I thing it is related to UI matters. The message is this:
Exception
Application::Run+0xf
Form1::Main+0xa
Mi application read info from serial port (from a GPS), with this event handler:
private void OnDataReceived(object sender, SerialDataReceivedEventArgs e) <br />
{ <br />
while(port != null && port.BytesToRead > 0) <br />
{ <br />
int Cnt = port.Read(portBuf, portPos, 1); <br />
<br />
if (Cnt != 0) <br />
{ <br />
if (portBuf[portPos] == '\n') <br />
{ <br />
string sentence = Encoding.ASCII.GetString(portBuf, 0, portPos-1); <br />
AddResult(sentence); <br />
<br />
portPos = 0; <br />
} <br />
else <br />
{ <br />
portPos++; <br />
} <br />
} <br />
}
} <br />
<br />
After much investigation, now I am able to cause that exception by clicking a button. The code is this, simple one:
<br />
private void btnClosePort_Click(object sender, System.EventArgs e) <br />
{ <br />
Cursor.Current = Cursors.WaitCursor; <br />
<br />
Thread.Sleep(1000); <br />
<br />
try <br />
{ <br />
port.DataReceived -= new SerialDataReceivedEventHandler(OnDataReceived); <br />
Thread.Sleep(1000); <br />
<br />
port.Close(); <br />
port.Dispose(); <br />
port = null; <br />
} <br />
catch (Exception ex) <br />
{ <br />
AddResult("-->Failure"); <br />
AddResult(ex.ToString()); <br />
} <br />
<br />
Cursor.Current = Cursors.Default; <br />
<br />
AddResult("-->Closed"); <br />
}<br />
Notes: AddResult simple does add strings into a ListBox.
The really strange thing is this: if I remove the AddResult(sentence) call in "OnDataReceive", the exception is not thrown.
Could it be any bug related to UI ?
My hardware: iPAQ 2100 , Windows Mobile 2003 SE
Hope you can help me
Thanks to all!
|
|
|
|
|
the ShortCut work fine, you just put & charecter on text, and use Alt key
with letter.
but i have problam:
we have a form with English Input textbox, but the ShortCut is on another
InputLanguage.
in MSAccess the shortcut work with 2 Language, but in dotnet the shortcut
must be on the same
language as InputLanguage!
i try to find event, or windows msg, to trap the point befor DotNet search
after control with shortcut,
but it's not work.
please help!
|
|
|
|
|
Assumption: both my server and client will use
System.Runtime.Remoting.RemotingConfiguration.Configure(configFile);
to read configuration file
Following are couple of ways I tried, none of them works:
(1)SERVER side:
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="ipc" portname="IpcChannelOne">
<channel ref="ipc" portname="IpcChannelTwo">
<service>
<wellknown type="MyServer.RemoteObjectOne, ServerAssembly"
="" objecturi="RemoteObjectOne.rem" mode="Singleton">
<wellknown type="MyServer.RemoteObjectTwo, ServerAssembly"
="" objecturi="RemoteObjectTwo.rem" mode="Singleton">
CLIENT side:
<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown type="MyInterface.IRemoteObjectOne,
InterfaceAssembly"
="" url="ipc://IpcChannelOne/RemoteObjectOne.rem">
<wellknown type="MyInterface.IRemoteObjectTwo,
InterfaceAssembly"
="" url="ipc://IpcChannelTwo/RemoteObjectTwo.rem">
(2)SERVER side
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="ipc" portname="IpcChannelOne">
<service>
<wellknown type="MyServer.RemoteObjectOne,
ServerAssembly"
="" objecturi="RemoteObjectOne.rem" mode="Singleton">
<channels>
<channel ref="ipc" portname="IpcChannelTwo">
<service>
<wellknown type="MyServer.RemoteObjectTwo,
ServerAssembly"
="" objecturi="RemoteObjectTwo.rem" mode="Singleton">
CLIENT side:
no change
(3)SERVER side:
<configuration>
<system.runtime.remoting>
<application>
<service>
<channels>
<channel ref="ipc" portname="IpcChannelOne">
<wellknown type="MyServer.RemoteObjectOne, ServerAssembly"
="" objecturi="RemoteObjectOne.rem" mode="Singleton">
<service>
<channels>
<channel ref="ipc" portname="IpcChannelTwo">
<wellknown type="MyServer.RemoteObjectTwo, ServerAssembly"
="" objecturi="RemoteObjectTwo.rem" mode="Singleton">
CLIENT side:
no change
(4)SERVER side
<configuration>
<system.runtime.remoting>
<application>
<service>
<channels>
<channel ref="ipc" portname="IpcChannelOne">
<wellknown type="MyServer.RemoteObjectOne, ServerAssembly"
="" objecturi="RemoteObjectOne.rem" mode="Singleton">
<channels>
<channel ref="ipc" portname="IpcChannelTwo">
<wellknown type="MyServer.RemoteObjectTwo, ServerAssembly"
="" objecturi="RemoteObjectTwo.rem" mode="Singleton">
CLIENT side:
no change
Please advise what is the right way to create both client and server side
configuration files.
Your help is highly appreciated!
Hang
Hang
|
|
|
|
|
i developed an applicatin in c#.net using the bandobjects. its a kind of deskbar like the google deskbar.
when i am trying to build its installer its doesnt register the dll which need to be registerd and if i register those twoo dll's through command line with "regasm" it starts working.
can anybody pls help me to know how can i run a batch file through a installer or is there any other way to do it.
i tried all the option available with the .net setup like the vscom register .
Thanks in advance to help me.
|
|
|
|
|
I'm not sure why the setup is not correctly registering the assemblies in the first place. First I would google and see if you can find more information.
But troubleshooting installs can be very complicated.
Alternatives are:
1) You can add an Installer class to the setup that uses conventional C# or VB.NET code to shell out the command line to register the assemblies. See the MSDN or search for articles on using Installer classes.
One disadvantage to using this approach is that you cannot rollback the process in an uninstall. By the time the Installer class code runs during an uninstall, the assemblies will already be gone, so regasm run from a commandline will not be able to unregister them. So the registry entries for the assemblies will be left on the machine.
2) You can accomplish a clean uninstall by not using regasm at all, but instead by creating all the equivalent registry entries directly. In this approach you must first determine all of the registry operations that are created during a regasm registration of the assembly. Then you add these keys to be written during during an install, and deleted during an uninstall. This approach is tedious and more difficult but it does result in a more professional setup that uninstalls cleanly. The trick is determining all the registry keys. There are various tools available that will "spy" on the registry and log any changes that can help you do this. But if you go this route, you must be careful to test, test and test again!
|
|
|
|
|
Hi all,
I just want to share this with you. There's people who loves writing software in notepad, i'm one of them. Programming with notepad can get you a big headache but in my opinion is more flexible in terms of custom components (custom editor, custom compiler, custom resource creator) and is very handy at compile time, using batch files (.bat) is the most common option for compilation when notepad is used instead an IDE.
I just found an incredible Opensource text editor for us: Notepad++
http://notepad-plus.sourceforge.net/uk/about.php[^]
You can download an executable with installer and a zipped version for people who likes "clean" apps.
It's not a resource hungry app, it's a notepad with syntax highlighting (many languages) and format encoding, and no additional features such as code completion, and others. It's a real tool for real brainy programmers.
Enjoy
|
|
|
|
|
In a Windows Form project, one inherited form from FormBase has one toolbar and one imagelist, both are public.
The imagelist object is linked to toolbar object. My problem is that the images don´t appear on the buttons of toolbar object when I add new buttons to toolbar, new images to imagelist object ,link them through Imageindex property and compile the code.
I realized that the source code generated for buttons in the InitializeComponent session are in the upper position of the source code generated for toolbar object. It may have cause the problem because the buttons have been defined before the toolbar is initialized.
How could I solve this problem? I would like to inherit others forms from FormBase and customize the toolbars per each form.
Please find below the code sample for InitializeComponent method. Please see that the ToolBarButton1 is added to toolbar before its definition.
'
'ImageList
'
Me.ImageList.ImageStream = CType(resources.GetObject("ImageList.ImageStream"), System.Windows.Forms.ImageListStreamer)
'
'Toolbar
'
Me.Toolbar.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {Me.ToolBarButton1})
Me.Toolbar.Name = "Toolbar"
Me.Toolbar.Size = New System.Drawing.Size(345, 28)
'
'ToolBarButton1
'
Me.ToolBarButton1.ImageIndex = 0
Att,
Emerson Valente
-- modified at 16:18 Tuesday 13th September, 2005
|
|
|
|
|
Got this in English? It's an English speaking board...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am working on a touchscreen jukebox program like some of the more modern ones you may have seen in bars or pool halls. It's quite generic right now but I have been playing around with the ListView control to display an accurate representation of the current playlist. I have gotten it so that the user can DragDrop items (music files) in (*not "into" from an outside source..yet) the playlist to alter the order of the songs, i.e. move track 1 to track 3, thus resulting in track 2 becoming track 1 and track 3 becoming track 2. You get the picture. Actually it's quite like the playlist ListView in Windows Media player right now. In any cause, when the user moves the media up and/or down the list I am drawing a line on the ListView Control between the items that the chosen media is to be moved and thus inserted. I am using Graphics and Graphics.DrawLine and it works fine. However, I have to ListView.Refresh() everytime the line changes otherwise a whole bunch of lines will just continue to be drawn on the playlist ListView. It is in Detail Mode Behavior btw. This is all dandy when I have just a few items in the playlist but when I get around 30 or so when I drag an item to be moved the ListView Refreshing causes the control to flicker. Nothing major but annoying and unprofessional. How do I get this to quit? The Media Player for Windows does not flicker. Also on a side note, when the playlist becomes too big for the ListView the scrollbars take effect however on mine I get a horizontal one as well and do not want it. Do I have to resize the ListView when it reaches a certain number of items to accomodate the width of the vertical scrollbar or is there a way to tell the ListView control not to display the horizontal scrollbar at all? Any help, suggestions, or comments would be greatly appreciated.
|
|
|
|
|
Gate Crasher wrote:
I am working on a touchscreen jukebox program like some of the more modern ones you may have seen in bars or pool halls.
Cool - I wrote one of those in C# a while ago. What do you use to play the files, DirectX or WMP ?
Gate Crasher wrote:
I have been playing around with the ListView control to display an accurate representation of the current playlist
I reckon you'd be better off with your own control, I found that I was.
However, the first step to eliminate flicker is to turn on double buffering.
SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true)
UpdateStyles()
in your form object. I'm not sure if VB lets you do |, or if + will do.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
I'm not sure if VB lets you do |, or if + will do.
It's ControlStyles.DoubleBuffer Or ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
Did you try enclosing the code within the Refresh method within BeginUpdate/EndUpdate? Something like
void Refresh()
{
listView.BeginUpdate();
...
listView.EndUpdate();
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|