|
YagiSka wrote:
I am simply refering to it as myLib.dll.
You need to give the fully qualified name or the location.
<a TITLE="See my user info" href=http:
|
|
|
|
|
The fully qualified name would be like
myLib.dll,version=1.0.0.0,publicKeyToken=2222222,culture=neutral
correct?
If so, I tried that and still ran into the same problem.
|
|
|
|
|
Alright, I fixed that problem, thanks for the help. However, this led to a new problem.
I am saving the compiled assembly to disk, and then reading the contents and loading it via Assembly.Load(). This is so that the file is not locked, and can be recompiled and reloaded.
However, I am getting an error when I try to use the xml serializer with a type found in this assembly. It tells me that the assembly may be dynamic, and I must save and load it from disk in order to use the xml serializer with it.
How can I avoid this. I absolutely need to use the xml serializer, and I absolutely need to prevent the file from locking.
Also, with this error be generating with the binary serializer as well?
Thanks
|
|
|
|
|
YagiSka wrote:
This is so that the file is not locked, and can be recompiled and reloaded.
That will cause multiple version of the same types to be loaded in the same appdomain. I'm afraid, you will have to load the assembly in another appdomain and use remoting to prevent to the type being consumed but the "main" appdomain.
Have a look at my Plugin Manager article. It could solve your problem.
<a TITLE="See my user info" href=http:
|
|
|
|
|
leppie wrote:
That will cause multiple version of the same types to be loaded in the same appdomain.
Right, but in my case that's actually not a bad thing. The program I'm writing has VERY long lifecycle objects. It is entirely possible for an object of both the old type and new type to exist at the same time.
Objects are persited in binary format, and it's simpler to modify the binary formatters behavior to update the objects to use the new code during a reboot then to try to update the objects when the program is running.
As to my xml formatter problem, xml in this program is mainly used to set values for newly created objects. Xml serialization doesn't really work for the type of objects I'm working with, so binary is used to save and load state after an object is first created. So since I'm only setting supplied values for types I can discover the public members of, I'm thinking of simply writing my own xml serializer.
|
|
|
|
|
Your alternative to the BinaryFormatter is the SOAPFormatter, but beware those files are @#$@## HUGE! XML serialization has many drawbacks, but those are tradeoffs for space. Another thing you can look at is the SerializationState (?). There is an enum with various options how the object will be de/serialized for persistance.
The ideal solution is to build some "basic" XML serializable objects and use a wrapper for the more complicated stuff.
HTH, I wish someone can create a "simple" solution for this.
<a TITLE="See my user info" href=http:
|
|
|
|
|
Ok, going through this, implementing my xml deserializer is turning out to be rather simple so far, but my needs for it are rather simple.
Only, I've run into an embarrasingly simple problem.
I get all the public, writeable properties in the type, and then look for corresponding information in the xml file.
If the property type is not a value type, then I do the same process for the object.
The only problem is when it's an array. If the property type returns as System.Array, how can I tell what type of array the property wants? As in string[], int[], object[], etc.
I am of course assuming that if I have a property of type string[], when I query the properties type it will return System.Array.
Thanks again
Kris
|
|
|
|
|
YagiSka wrote:
Only, I've run into an embarrasingly simple problem.
I only learnt of this recently too after a year
Type.GetElementType()
Note: It does not work on interfaces
<a TITLE="See my user info" href=http:
|
|
|
|
|
Do you have to use ADO.NET with C# or can you use the older versions of ADO from MDAC?
If you can use ADO are there any "gotchas" (problems) that I should look out for?
Thanks!
-Al
|
|
|
|
|
You can use a OleDbDataAdapter (generic provider) that can communicate with any OLE DB data source.
Connection and Command objects are almost equivalent to their ADO
counterparts.
IIRC, DataAdapter and DataSet have no real equivalent in ADO.
The only job you start at the top is when you dig a grave. This signature was created by "Code Project Quoter".
|
|
|
|
|
It should be possible through COM interop, no idea on any 'gotchas' though.
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
albean wrote:
If you can use ADO are there any "gotchas" (problems) that I should look out for?
If you create lots of ADO Recordsets, your program can behave like it's leaking memory. Technically, it isn't, but it will look like a leaky program.
Don't forget to call System.Runtime.InteropServices.Marshal.ReleaseComObject on every COM object that you have created on managed code, until it returns 0.
Kant wrote:
Actually she replied back to me "You shouldn't fix the bug. You should kill it"
|
|
|
|
|
Daniel Turini wrote:
System.Runtime.InteropServices.Marshal.ReleaseComObject
From Chris's weblog, that doing so in normal desktop apps, which involves modest com interop, this could lead to additional problems.
Even though half of what he say's is above my head, I got curious after reading his concolusion part.
I'm a bit confused here, whether failing to do a releasecomobject would cause a performance penalty or a memory leak.
And also I would get more benefits only if its a server based app.
Here is the link[^]
Cheers,
Kannan
|
|
|
|
|
Kannan Kalyanaraman wrote:
From Chris's weblog, that doing so in normal desktop apps, which involves modest com interop, this could lead to additional problems.
Even though half of what he say's is above my head, I got curious after reading his concolusion part.
I'm a bit confused here, whether failing to do a releasecomobject would cause a performance penalty or a memory leak.
And also I would get more benefits only if its a server based app.
Here is the link
I love Chris's weblog. In this case, he's stating the obvious: after you call releasecomobject until it returns 0, you cannot access the component anymore (right, you released it!).
Now, he's right: on server applications (what I do for living) you normally have a disconnected model, so, once a "job" is finished, it's better you clean up everything, except caching data. On desktop applications, you normally code for responsiveness, so dangling references are common. In this case, you need to be careful to only releasecomobject when no one is accessing it.
If your COM objects are small and not in a big number, you don't have to worry, because it will take time, but the GC will clean it up. It's only on the case when you have 10MB of RAM taken by ADO recordsets that it becomes unacceptable, because it will take ages for the GC to clean up them.
Kant wrote:
Actually she replied back to me "You shouldn't fix the bug. You should kill it"
|
|
|
|
|
Add a reference to the old ado by looking on the .Net tab in the references dialog. There is a reference there to the old adodb called adodb. I don't know of any gotcha's for you. I have only used it briefly. It worked fine for me. Very small project though.
|
|
|
|
|
I'm looking for a page on the Internet or in MSDN that describes the event hierarchy for System.Windows.Forms.Form.
I'm trying to figure out why the form1_load event keeps firing.
Thanks,
al
|
|
|
|
|
Is there something similar to app.path in C# for the path of an application's folders and files.
|
|
|
|
|
If you need the current directory, try Environment.CurrentDirectory
If you want generic Application Data directory,
try Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData
Cheers,
Kannan
|
|
|
|
|
If it's an SWF program, you can also try Application.ExecutablePath .
Greets,
Daniel
|
|
|
|
|
you can also try this :
string str;
string s;
str = Application.UserAppDataPath.ToString();
s = str.Substring(0,3);
MessageBox.Show(s);
that would return in this exapmle "C:\" , because i was testing it from a drive called C
switch(twinsOnWay)
{
case ("twins on the way"):
MessageBox.Show("for mr and mrs dynamic","twins on the way");
break;
|
|
|
|
|
Hi, all:
When I click on the menu item "Save", right after I edit the text in my Textbox control, in my WinForm, it does not cause validation of the TextBox control. Is there any way to force validation of the control. BTW, if I click on the x to close the form or any other controls on the form, it does cause validation. Any help is appreciated. Thanks in advance.
Dion
|
|
|
|
|
DO something like the following, it worked for the same problem:
if (panel1.Controls[0].DataBindings.Count > 0)
panel1.Controls[0].DataBindings[0].BindingManagerBase.EndCurrentEdit();
<a TITLE="See my user info" href=http:
|
|
|
|
|
We want to use the auto-documentation for our C# project. Since the output of the documentation is XML, I believe that I need an xsl or something like that (sorry, I'm not proficient in XML) to transform the file to whatever I want (html, ...).
Is there any example of such a thing, so I could start from there? It would be nice to add one that produces MSDN-like HTML.
|
|
|
|
|
Michel Prévost wrote:
Is there any example of such a thing, so I could start from there? It would be nice to add one that produces MSDN-like HTML.
I hate to ruin the fun you'd have with countless hours of XSL and CSS coding to achieve this result, but someone already did it
http://ndoc.sourceforge.net/[^]
Kant wrote:
Actually she replied back to me "You shouldn't fix the bug. You should kill it"
|
|
|
|
|
Ndoc[^]is the answer
Cheers,
Kannan
|
|
|
|