|
Hi!
this[^] MSDN page told me, I couldn't unload assemblies except I load them into an extra AppDomain and then unload the whole AppDomain. But how to do this? Can someone might give me a little example?
EDIT: I want to load the assembly from a file.
Thanks in advance, Eric
|
|
|
|
|
|
In "How to load assemblies into..." I can only read how to load assemblies into the current AppDomain, which isn't very helpful..
|
|
|
|
|
It's not very obvious I'll admit:
"Methods such as CreateInstance and CreateInstanceAndUnwrap of the AppDomain class can load assemblies into an application domain."
Simon
|
|
|
|
|
If you look in the method details for CreateInstanceAndUnwrap it includes an example for running code in a different appdomain.
(You should note that the assembly that contains the object you create with CreateInstanceAndUnwrap will be loaded into both appdomains, but you can use the object to load further assembiles only into the domain the code is running in. See the CreateInstanceAndUnwrap[^] page)
Simon
|
|
|
|
|
Great! Works now... Thx
|
|
|
|
|
public class DownloadQueue<TCallBack>
{
} In the above code, I need to allow only delegate types for TCallBack . I am not able find System.Delegate in the "where" condition. I tried this
public class DownloadQueue<TCallBack> where TCallBack : System.Delegate
{
} But it's not allowing to write so. Any other methods for this ?
|
|
|
|
|
Certain types are restricted from being used as generic constraints. Unfortunately, this is one of them (enum is another).
|
|
|
|
|
Thanks Pete. Any alternative method to ensure it ?
|
|
|
|
|
How does typing a generic parameter to System.Delegate help? It might be that you have a design issue that needs a different solution or perhaps requires a better understanding of the problem to begin with.
led mike
|
|
|
|
|
Yes you are correct. I had a design issue and I solved it. Your help is much appreciated.
|
|
|
|
|
Hello everyone,
I debugged the sample carefully. But one question I can not find from MSDN, who calls method IFormatProvider.GetFormat of class AnyRadix? When we call String.Format, this function is called?
http://msdn.microsoft.com/en-us/library/system.iformatprovider.getformat(VS.80).aspx
thanks in advance,
George
|
|
|
|
|
This line passes the format provider to the String.Format method
Console.WriteLine( String.Format( provider, messageStr, argToConvert ) );
String.Format calls the GetFormat method on the provider to get the formatter. You can look at the Code in for String.Format in reflector to see what's going on. (Haven't tried this myself)
You can see this in the debugger by sticking a breakpoint in the GetFormat method and waiting till it is hit then looking at the call stack. (Debug->Windows->CallStack (Ctrl+D,C))
Simon
|
|
|
|
|
Thanks Simon!
My study result is, when calling String.Format( provider, messageStr, argToConvert ),
1.
provider.GetFormat is called and returned an intance of AnyRadix;
2.
Then Format method is called on the returned instance of AnyRadix, and messageStr/argToConvert are passed as formatString/argToBeFormatted parameter, and a string is returned from Format method -- the returned string is also treated as the result of String.Format call -- String.Format( provider, messageStr, argToConvert ).
My analysis correct?
regards,
George
|
|
|
|
|
Sounds about right. Like I say, I haven't looked in reflector myself.
Simon
|
|
|
|
|
Thanks for your help, Simon!
regards,
George
|
|
|
|
|
I have to deploy my application which uses MS SQL Express as a database. I have to deploy my program to end-user who knows nothing about database configuration. How can I deploy my project and MSSQL express with one MSI installation package. I've found an answer in expert-exchange, but they won't let me in, as I have to pay. Thanks you guys
|
|
|
|
|
1st, try the databases forum. This one is for c# questions.
2nd. If you scroll to the very very very bottom of the experts exchange page, they have all the answers uncovered for free. (Yes, I know it's weird, it's some kind of advertising con to get people to pay them for free content)
Good luck
Simon
|
|
|
|
|
hi!
i m using c# , i used EXpTreeLib.dll , tree view and one more dll Emmaculate.dll , thumbnelview , the
probelm is that when i making a setup using Setup&deployment wizard i added both dll , project is working
fine but when i open this form then the unhandeled exception occured Error path not found etc in other
system not mine , in my pc when i running the project is working fine , may its not getting control path
what should i do .................plz help me
i think i should register the dll in other system on which i m running the exe but ,
when i register the both dll , ExpTreeLib.dll , emmaculate.dll in other system in which i m running exe
after making setup
error occure dll not register entry point not found.
in my pc project running fine , setup complete fine and also exe running fine but when i deploy in other
system then its making a problem in that form that is using both dll.
Entry point not found ..............
on run :
regsvr32 c:\ExpTreeLib.dll
error occure entry point not found may i registed that dll so its resolve the above problems.
Love is Life & Life is Love!
|
|
|
|
|
nomi wrote: entry point not found
Likely cause might be that method Main is missing.
|
|
|
|
|
dani thanks to reply , yar i wanna know that y its running fine in my system and when i deploy on other system then this form is generate a error , path is not missing unhadeled exception etc in this form i just use two dll that i define earlier so what should i do , should i register the dll or what can i do , and how to know where is the error , means main cause of the error ......
Love is Life & Life is Love!
|
|
|
|
|
Are you providing right function name and passing right arguments while calling the function of the dll?
|
|
|
|
|
yes offcourse bcz its running fine on my system , error occure in other computer when i running the exe of the project , error just occure in particular form others are working fine
may dll not getting its path , i dont understand how can i know what is the source of error
Love is Life & Life is Love!
|
|
|
|
|
here i have created one of user control in C#, and i want make it to Activex Control, how can i call the dll without contain any interface in my application, i have only the events like click, plug..........
here how can i too cal that dll into Javascript........
|
|
|
|
|
i am trying to pick a image file from open dialog box and send to other user in C#.net
private System.Windows.Forms.OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.RestoreDirectory = true;
openFileDialog1.FileName = "";
openFileDialog1.Filter = "Graphic Interchange Format (*.gif)|*.gif|" +
"JPEG File Interchange Format (*.jpg;*.jpeg)|*.jpg;*.jpeg";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string filename = openFileDialog1.FileName.Substring(openFileDialog1.FileName.LastIndexOf("\\") + 1);
File.Copy(openFileDialog1.FileName, Application.StartupPath + "\\Temp\\" + filename, true);
string fname = Application.StartupPath + "\\Temp\\" + filename;
if(File.Exists(fname))
WhiteBoard1.iSelected = fname;
FileInfo info = new FileInfo(WhiteBoard1.iSelected);
long filesize = info.Length;
if(filesize>0)
{
WhiteBoard1.strConfid = strConfid;
WhiteBoard1.LoadImage();
}
}
In whiteboard class
public void LoadImage()
{
try
{
Graphics grphs = CreateGraphics();
if(File.Exists(iSelected))
{
Image img1 = Image.FromFile(iSelected);
pict.Image=img1;
}
}
catch(OutOfMemoryException)
{
MessageBox.Show(msg.ToString());
}
}
I get exception as
OutofMemory Exception
|
|
|
|