|
I have a console application, which is a WSE2 Web service with several soap methods. The application starts and the memory usage increases constantly until it reaches to approximately 700MB, then it won't respond anymore. This memory leak happens on Windows 2K3 with SP2 Framework 1.1, but i can't reproduce it in Windows 2K SP4, weird isn't it
I've reviewed the code in each method to release resources and call Dispose if needed. I have also checked some counters with perfmon and clr_profiler, but no clue of what is causing this behavior. Please help me
|
|
|
|
|
hi guys i am creating an application in which i am creating a dll at runtime.
i have defined one parameterized construcor,every thing goes ok.,
when i am going to save this dll on the disk , it says, "classname" my type is not completed
why
?
thanks in advance
hello
|
|
|
|
|
This is a problem that occurs when developing with .Net Framework 2.0 (coding and debugging in VC++ 2005 Express and VC# 2005 Express):
1. Create a normal Windows SDK Console application that loads a DLL using LoadModule() and calls a function (lets call it "load") on the loaded dll.
Lets call the application "App".
2. Create the dll to be loaded: A C++ .Net class library which implements the given "load" function. "load" loads a pure .Net assembly (eg written in C#), takes a static method from it and calls it. It also needs to provide a sample ref class with a method, named ClassA and MethodA.
Lets call this library "PluginA".
3. Create a .Net Class Library in Visual C#, add PluginA to the reference list and implement the static method which will be called by PluginA. In the method it should use ClassA and call MethodA on it.
Lets call the C# lib "PluginB".
4. Ensure that all 3 projects are in different folder. Eg.:
App in App,
PluginA in App/Plugin
PluginB in App/Plugin/DotNet
What happens:
App loads PluginA
PluginA loads PluginB
PluginA and PluginB are now in the same AppDomain and PluginA's Assembly-object contains the desired type ClassA (I checked).
The Problem:
PluginB will still try to load the referenced PluginA again and fail when trying to access ClassA if PluginA is not in PluginB's working directory.
If PluginA is in PluginB's working-directory, PluginB will load PluginA again and AppDomain.CurrentDomain.GetAssemblies() will contain PluginA's Assembly Object twice.
Conclusion?
If 2 Assemblies are in the same AppDomain, they should both be able to use each other's types without having to reload them - Why is this not the case?
This seems to be a bug and MS doesn't seem to have a bugtracker...
-- edit:
It doesn't matter if PluginA uses Assembly.Load(byte[]), Assembly.LoadFrom(string) or Assembly.LoadFile(string), if PluginA is signed or not doesn't seem to play a role either.
PluginB's MethodA of ClassA (C++/CLI) contains:
array^ asms = AppDomain::CurrentDomain->GetAssemblies();
Console::WriteLine("Current assemblies:");
for (int i = 0; i < asms->Length; i++) {
Assembly^ as = asms[i];
Console::WriteLine(as->GetName());
}
When called by PluginB, the output is the following:
Current assemblies:
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
PluginA, Version=1.0.2837.29213, Culture=neutral, PublicKeyToken=a740aaa0a688231e
msvcm80d, Version=8.0.50608.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
PluginB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
PluginA, Version=1.0.2837.29052, Culture=neutral, PublicKeyToken=a740aaa0a688231e
Where the second PluginA Assembly object has been loaded by PluginB, after I copied PluginA again to the working directory. If I do not copy PluginA, PluginB (when PluginA uses Assembly.Load(byte[]) for loading) will throw the following exception (Standard windows Console output, thus badly formatted - sorry):
##########################################################################
Failed loading assembly: System.Reflection.TargetInvocationException: Exception
has been thrown by the target of an invocation. ---> System.IO.FileNotFoundExcep
tion: Could not load file or assembly 'PluginA, Version=1.0.2837.29052, Culture=
neutral, PublicKeyToken=a740aaa0a688231e' or one of its dependencies.
File name: 'PluginA, Version=1.0.2837.29052, Culture=neutral, PublicKeyToken=a74
0aaa0a688231e'
at PluginB.Class1..ctor()
=== Pre-bind state information ===
LOG: User = DOMINIK\Domi
LOG: DisplayName = PluginA, Version=1.0.2837.29052, Culture=neutral, PublicKeyTo
ken=a740aaa0a688231e
(Fully-specified)
LOG: Appbase = file:///d:/Projects/C++/test/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : PluginB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=
null.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2
.0.50727\config\machine.config.
LOG: Post-policy reference: PluginA, Version=1.0.2837.29052, Culture=neutral, Pu
blicKeyToken=a740aaa0a688231e
LOG: Attempting download of new URL [...]
I also posted this behavior at: Microsoft forums
|
|
|
|
|
Doomii wrote: This seems to be a bug and MS doesn't seem to have a bugtracker
http://connect.microsoft.com/[^]
Doomii wrote: It doesn't matter if PluginA uses Assembly.Load(byte[]), Assembly.LoadFrom(string) or Assembly.LoadFile(string), if PluginA is signed or not doesn't seem to play a role either.
If you use 'Assembly.LoadFrom(string assemblyLocation)' then that method should try and resolve all the references of the assembly it's loading. From what I've seen when playing with my own plugin stuff it'll only try and load any assemblies not already loaded. These assemblies of course have to be the same version otherwise they are treated as 2 seperate assemblies.
Doomii wrote: Current assemblies:
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
PluginA, Version=1.0.2837.29213, Culture=neutral, PublicKeyToken=a740aaa0a688231e
msvcm80d, Version=8.0.50608.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
PluginB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
PluginA, Version=1.0.2837.29052, Culture=neutral, PublicKeyToken=a740aaa0a688231e
You can see in your output that 'PluginA, Version=1.0.2837.29213' and 'PluginA, Version=1.0.2837.29052' have different versions.
|
|
|
|
|
originSH wrote: You can see in your output that 'PluginA, Version=1.0.2837.29213' and 'PluginA, Version=1.0.2837.29052' have different versions.
Thats just because i didn't update the copied PluginA in the working directory. It doesn't matter, even if I use an updated version, the problem is still the same, see here:
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
PluginA, Version=1.0.2837.29477, Culture=neutral, PublicKeyToken=a740aaa0a688231e
msvcm80d, Version=8.0.50608.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
PluginB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
PluginA, Version=1.0.2837.29477, Culture=neutral, PublicKeyToken=a740aaa0a688231e
originSH wrote: If you use 'Assembly.LoadFrom(string assemblyLocation)' then that method should try and resolve all the references of the assembly it's loading.
It should, but it sadly doesn't. I get the same problem if I compile PluginB with the updated version of PluginA (which I always do) and use LoadFrom instead (the output above is generated when using LoadFrom). If I don't copy "PluginA, Version=1.0.2837.29477, Culture=neutral, PublicKeyToken=a740aaa0a688231e" to the working directory, it will say:
Could not load file or assembly 'PluginA, Version=1.0.2837.29477, Culture=neutral, PublicKeyToken=a740aaa0a688231e' or one of its dependencies.
Which clearly is already loaded.
|
|
|
|
|
You can try hooking into the assemblyresolve event on the AppDomain:
"AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);"
that will allow you to resolve the assembly yourself if .Net fails, that will atleast let you then do the load manually from the already loaded assemblies.
|
|
|
|
|
This is great! Now it finally works!
Although, similar to the solution posted on the MS boards (use the GAC, which I prefer not to (although I know I am recommended to)), the reason for why the bug actually existed is unclear.
|
|
|
|
|
|
I am using VS2005 with Windows XP and I want to programmatically access "Display Properties - Settings - Extend My Windows Desktop Onto This Monitor" by pressing a checkbox. Can you please tell me where I can access this property from my code, Thanks Brennan
|
|
|
|
|
Have you resolved this?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
hi all,
Can some one tell me the new features of .net framework 2.0 at the architecture level,
i.e the changes in compilation,gc compared to compilation ,gc in 1.1 version.
I need the changes at the architecture level
would be happy if someone give reply.
|
|
|
|
|
Oh if only somebody could come up with some tool that would make it easy to type things in and search this new fangled interweb thingy. I wonder if somebody could come up with some way to do this:
http://www.google.co.uk/search?hl=en&q=new+features+.net+2&meta=[^]
See - it's easy. Just look at the top result.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
hi,
i checked the url already and it just shows the control suppport for .net framework 2.0 not at architecture level
i need the features at architecture level only
Thanks
Mukkanti
|
|
|
|
|
I don't know which URL you looked at, but the first hit when I run the search contains the following list:[^]
64-Bit Platform Support
Access Control List Support
ADO.NET (a number of changes)
ASP.NET (a number of changes)
Authenticated Streams
COM Interop Services Enhancements
Console Class Additions
Data Protection API
Debugger Edit and Continue Support
Detecting Changes in Network Connectivity
Distributed Computing
EventLog Enhancements
Expanded Certificate Management
.
.
.
It goes on for a while, I can't be bothered to copy paste it - needless to say it shows a lot more than just "controls".
We can't guess what you consider an architecture level, but if you do not see it in the list, it is probably not changed significently. For example, why should they change the garbage collector?
|
|
|
|
|
I want to do write protect a drive to all system users using Vb dot net. For that i am using the below code. But I am getting Deny permission for the "special Permission" of the selected Drive. Not for the write permission.
Please see the below code.
======================================================
Dim folderLocation As String = "F:"
Dim mydir As New DirectoryInfo(folderlocation)
Dim dirsecurity As DirectorySecurity = mydir.GetAccessControl
Dim fsec As FileSecurity
Dim domain As String = LCase(Environment.UserDomainName)
Dim username As String = Environment.UserName
Dim Drive As String = "F:"
fsec = File.GetAccessControl(Drive)
For Each rule As FileSystemAccessRule In dirsecurity.GetAccessRules(True, True, GetType(NTAccount))
username = rule.IdentityReference.ToString()
MsgBox(".[" + username + "]")
fsec.SetAccessRule(New FileSystemAccessRule(username, FileSystemRights.WriteData, AccessControlType.Deny))
File.SetAccessControl(Drive, fsec)
Next
==================================================
I want to that am i doing proper method or not. if not please suggest the correct way to me for doing the write protect a single drive .
Gopi Ramanathan,
Life will never be the SAME
|
|
|
|
|
Is there any downloads for Mircosoft.net for the contentpipeline content. like bitmap and picture content mainly.
Michael
(Up and coming Game programmer)
EST
|
|
|
|
|
If there is any green cheese on the moon? I doubt it... Oh wait, that was not your question. If you are not capable of writing something as simple as a subject header telling what you want then I suggest you start learning that before moving on to more dificult things like programming.
A search for Content Pipeline on Google suggest the XNA Framework[^].
Next time:
1) Google
2) Write a meaningful subject.
Personally I will not provide any further assistance before you learn these basic skills.
|
|
|
|
|
I agree. Many posters don't understand why meaningful subjects are important and, possibly, are not familiar with the terminology. If I need help with anything, I search the subjects. "Is there any..." will not help me in my endeavor. You got my 5.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi. Does anyone know how to make a windows form behave like a menu, such that it closes if the user clicks anywhere away from it?
It would also be nice if the window didn't steal the focus from the parent form, but this isn't necessary.
|
|
|
|
|
Haha, silly me:
private void NoteForm_Deactivate( object sender, EventArgs e ) {<br />
this.Close();<br />
}
|
|
|
|
|
Hi!
I have been looking all over internet after an Excel-component to use for reading excel-documents and calculate formulas.
Anyone know wher i can find it?`
//Maw
|
|
|
|
|
It's called Excel. There's no way I know of, apart from controlling Excel through the Microsoft Office SDK, whatever they call that thing.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Here is one way, although there may be other/better ways:
Add a reference to the MS Excel object library.
In your code, you can use the Excel objects directly:
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlBooks As Excel.Workbooks
Dim xlSheets As Excel.Sheets
Dim xlSheet As Excel.Worksheet
Once you create an instance of the Excel app,
xlApp = New Excel.Application
You can address any object in the spreadsheet
xlBooks = xlApp.Workbooks
xlBook = xlBooks.Open(strPath & "Sheetname.xls", True)
xlSheets = xlBook.Worksheets
xlSheet = xlSheets(1)
Values in cells can be accessed and modified by range
intListRow += 1
strRange = "A" & CStr(intListRow)
strSheetValue = xlSheet.Range(strRange).Value
Remember to close the app or there will be an Excel process still open on the machine.
xlBook.Close(True)
xlApp.Application.Quit()
xlApp = Nothing
|
|
|
|
|
I'm back with another question regarding some PHP code I converted to C#.
The PHP code uses OpenSSL to verify a signature (it's a string of characters, as opposed to being attached to a file). I have the public and private keys.
Can I use the crypto stuff built into .net to verify the signature, and if so, can someone point me to a place that describes how I would go about doing so?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi,
I am going to develop a C# windows application and deploy in a server. This exe file will be used by around 10 people at the same time. I think it will create new instances for each user.
What I want to know is, are there any know issues for these kind of scenarios? What the general good practices for this kind of application?
Thanks & Regards
|
|
|
|
|