|
It means that you have the worker threads query for information, or jobs to complete. They wait (block) on a wait handle that is signaled when work is available. They get the work, perform their operations, then block again waiting for the wait handle to be signaled.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
To be placed in the GAC, an assembly must have a strong name. I know both strong-named assemblies and shared assemblies can be placed in GAC.
So what's the use of shared assemblies? How can they be in GAC without strong name?
I'm
Promise only what you can do. And then deliver more than what you promised. This signature was created by "Code Project Quoter".
|
|
|
|
|
You're confusing .NET assemblies with Win32 assemblies. An assembly is just a file containing other information and a manifest of that information (like a Java jar file). .NET assemblies contain embedded resources, modules containing IL, and metadata. Win32 assemblies are still native executables that have a manifest file associated with them and are installed in the %WINDIR%\WinSxS directory in Windows XP and above. They are not installed into the global assembly cache for .NET.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I was talking about this:
Shared Assemblies
Assemblies shared by multiple applications should be installed in a centralized repository called the global assembly cache. .NET clients can access the same copy of the interop assembly, which is signed and installed in the global assembly cache.
Link...[^]
Promise only what you can do. And then deliver more than what you promised. This signature was created by "Code Project Quoter".
|
|
|
|
|
Then apparently there's no different regarding .NET assemblies. I apologize, but I've never heard them referred to as "shared" assemblies. The terminology makes sense, though. By installing assemblies into the GAC they are shared, but they must still be signed. Assemblies should be signed anyway for any production code. It's not like it's hard. Just run "sn.exe -k KeyFile.snk" to generate a key. Refer to that for all your assemblies for either a product or your organization. Consider it a satefy mechanism to safe-gaurd against spoofying attacks (replacing your assemblies with malicious assemblies - unless they replaced them all).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am having an issue loading an assembly. Two days ago, this exact same code was working. Today, I cannot, for the life of me, get the module to load. Here is the relevant code:
public ArrayList FindModules(string path,Type type)
{
ArrayList modulesFound = new ArrayList();
foreach(string file in Directory.GetFiles(path))
{
FileInfo fileInfo = new FileInfo(file);
if (fileInfo.Extension == ".dll")
{
Assembly assembly = Assembly.LoadFrom(file);
foreach(Type t in assembly.GetTypes())
{
if(modulesFound.Contains(file))
break;
foreach(Type iFace in t.GetInterface())
{
if(iFace.Equals(IModule))
{
modulesFound.Add(file);
break;
}
}
}
}
}
return modulesFound;
}
The problem is with the if(iFace.Equals(type)) line. It doesn't recognize that iFace is the same as IModule. If the line is changed to iFace.Name == "IModule" , the it loads the module, but returns a null instance.
Any Ideas????
Thanks,
Craig Wilson
|
|
|
|
|
Use iFace.Equals(typeof(IModule)) instead.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank you for your response. I must apologize because I typed my code in incorrectly. I am doing just what you said and it still does not work. See the bottom of my original post. That is what confuses me. The names of each type are the same, but the types are not...
Thanks,
Craig Wilson
|
|
|
|
|
I'm not sure what I did, but it works now. Thanks for your help. Somehow, I think it was getting assemblies mixed up or something. Anyhow, Thanks.
Craig Wilson
|
|
|
|
|
That's what I figured and was about ready to state. Even though a type may have the same namespace and name, a Type is also comprised of assembly information, consisting of the name of the assembly, the culture info, version, and public key token (if strongly named, which assemblies always should be in any production code).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi, I'm developing a smart device application in c# at the moment.
I have made a webservice who access my SQL database and returns a DataSet with data (a name and an ID).
The meaning is that the first combobox will fill with the associations, and by choosing an association, the second combobox will fill with the institutions of that association.
In my webapplication, I have databinded this DataSet white success to my dropdownlist, but in this mobile application, I always have an error. (but finally I also receive the right information, my combobox will fill with the right information)
I've catcht the error in a messagebox so my programme won't stop during running, and I found out that during Page_Load() he gives the error catched in ComoboBox1_IndexeChanged().
By starting the application, I get first a few "error2-FormatException" and than an "error1-ArgumentException". Afther that my combobox is filled with my associations. By selecting another association, I get an "error2-ArgumentException" before my combobox is filled with the institutions of that association.
I know it's a long explanation but I've tried everything and all the examples I've found on the internet gives exactly what I have programmed.
Can anyone please help me with it??
Thank you very much
private void Form1_Load(object sender, System.EventArgs e)
{
try
{
Service service = new Service();
DataSet dataset = new DataSet();
dataset = service.getAssociations();
comboBox1.DataSource = dataset.Tables["associations"];
comboBox1.DisplayMember = "cName";
comboBox1.ValueMember = "ID";
comboBox1.DataBindings.Clear();
comboBox1.DataBindings.Add("SelectedValue", dataset, "associations.ID");
}
catch (Exception error)
{
MessageBox.Show(error.ToString(), "error1");
}
}
private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
try
{
Service service = new Service();
DataSet dataset = new DataSet();
dataset = service.getInstitutions(Int32.Parse (ComboBox1.SelectedValue.ToString()));
comboBox2.DataSource = dataset.Tables["institutions"];
comboBox2.DisplayMember = "cName";
comboBox2.ValueMember = "ID";
comboBox2.DataBindings.Clear();
comboBox2.DataBindings.Add("SelectedValue", dataset, "institutions.ID");
}
catch (Exception error)
{
MessageBox.Show(error.ToString(), "error2");
}
}
|
|
|
|
|
How would I go about creating a virtual file item in C#?
This is continuing my interest in developing a drag drop feature. Generaly, files are dropped by handling their HDROP, and therefore, i would need to create a file to do this.
However, for dragging and dropping, the process of creating large files prior to the drag proceess would be horribly costly, so i would like to instead create a virtual file type structure that contains binary serialized data, and can be handled like a system file by OLE methods.
Can this be done?
Cata
|
|
|
|
|
You're answer lies in the documentation for the TYMED data type, which is used in the FORMATETC and STGMEDIUM structures which I mentioned to you months ago when you started this venture. You're only three real options besides creating a physical file to hold the file contents is to lock the file contenxt in global memory (bad for large files), or implement IStream or IStorage to pull the file data when requested.
Say you use an IStream (TYMED_ISTREAM ) implementation to "store" your file contents. This is independent of the clipboard format (for which you could still use the CF_HDROP clipboard format). When a drop target says, "hey, I can take a file to be moved or copied", it gets the storage type (TYMED ) from the format info (FORMATETC ) and gets a pointer to that from the storage medium information (STGMEDIUM ). So long as it understands the storage type (which things usually do), it starts making requests on your IStream implementation, which is where you start feeding it information about your file.
That's about as "virtual" as you're going to get, unless you want to go to the practically impossible task of creating a block device in Windows (easy in *nix, NOT easy in Windows).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Ahhhh. I thought i should have done it that way, but it wasn't too sure if it was expecting a stream or an actual file object handle.
So the IStream interface can be dropped to shell, and if i handle it with HDROP, it will construct the file for me?
In which case, i need to set the file name(s) via _DROPFILES. (Where is this object placed? Are there two STGMEDIUM objects, one for the stream, one for the descriptor? I'm a bit fuzzy on that issue, i didn't find the documentation on it that helpful)
I need to implement whatever version of IStream i want to use in a C# based object and define the interface behaviour from the managed end. IStream would in this case tie into a stream object created by serializing an object.
However, to handle this custom IStream, i will also need to build a managed DataObject that implements the IDataObject interface, unless I can get a random IDataObject from the shell and use SetData to set my IStream to the item.
That about right?
Dropping INTO managed code is a piece of cake, shame the reverse is such a pain in the a*se.
Cata
|
|
|
|
|
All the IStream implementation (and it does have to be the actual COM IStream interface, or use the UCOMIStream interface in .NET) has to do is provide an implementation that gets the file bytes. The drop target doesn't care where they come from, as long as the object you pass it supports that interface. Your implementation could simply return the file contents in the IStream::Read method.
And yes, you still need to use the various COM interface for DnD because the similarily-named .NET interfaces don't expose what you need. IIRC, you can still use the managed DoDragDrop but you need to use the COM IDataObject interface.
Use .NET Reflector[^] or ildasm.exe (if you can read IL) to look at how Control.DoDragDrop works. It eventually uses the COM interfaces, otherwise it couldn't communicate with anything that is not a .NET application.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
What about the IOLEDataObject?
I have implemented my own managed version, and this one appears to be an unmanaged type that is already registered in the managed DoDragDrop method through casting. If i register my own version of IOLEDragDrop, will it be cast properly by the dodragdrop method? Or do i need to implement a whole new DDD?
Also, where the hell do i declare the name of the file to be constructed? (I think this is the final element of the puzzle, everything else I can do).
As always, thanks for your help.
Cata
|
|
|
|
|
Forget about using managed declarations of unmanaged code already in the .NET FCL assemblies - do it all yourself. Functions like DoDragDrop aren't hard at all. You're making this hard than it really is.
All the IStream implementation is is the storage medium for the file, as opposed to a physical file that already exists or a file locked in globally accessible memory (among other storage mediums that don't really work for most files).
The name can bet set in the STATSTG structure that is used with the STGMEDIUM . See STATSTG.pwcsName for more information. This is returned from IStream::Stat for the implementation used in STGMEDIUM .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
if i just buy a VC++.Net but not the whole Visual Studio.Net
package, can I still use it to develop software for Pocket PC 2003/Smartphone by using the compact framework extension ?
and can I develop software on PocketPC/Smartphone by using
C# ?
Thanks
|
|
|
|
|
I haven't done it myself but I don't think there is problem with that.You can get better answer in VC++ forum.
pyhtang1 wrote:
can I develop software on PocketPC/Smartphone by using
C# ?
Sure.
Mazy
"Man is different from animals in that he speculates, a high risk activity." - Edward Hoagland
|
|
|
|
|
Mazdak wrote:
can I develop software on PocketPC/Smartphone by using
C# ?
Sure.
Not if you only buy VC++ though, you'd need Visual c#
|
|
|
|
|
Of course, but I can't see in that statement he mention that.
Mazy
"Man is different from animals in that he speculates, a high risk activity." - Edward Hoagland
|
|
|
|
|
Actually, you don't need either. Download the .NET Framework. You've got the C# compiler. Download the .NET Framework SDK for more tools and documentation. You can do the same with Compact Framework (CF). Download the runtime. That's really all you need. You can find all the documentation in MSDN Library[^].
Now, if you can't develop without designers and drag-n-drop, then you'll need to get Visual C# .NET. If you look at the price, by the time you purchase two packages you've just spent more than you would for Visual Studio .NET.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Isn't there an open source IDE for C# development? I can't recall the name. Does that support CF?
Sammy
"A good friend, is like a good book: the inside is better than the cover..."
|
|
|
|
|
You're thinking of SharpDevelop (#develop)[^], and I don't believe it supports CF designers, but you don't really need them anyway. Drag-n-drop development is not true development. IDE's are handy, but being able to develop without them is what helps make you a decent developer.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Uh oh. You mean using VS.NET will always make me beneath all those who develop by hand?
But I thought that the real essence is not code writing, it's really the thinking behind it, if you know what I mean. This is why IDEs are okay, because they let you concentrate on writing the code that really matters, not the one you know by heart how to write already (like instantiating forms and controls).
Sammy
"A good friend, is like a good book: the inside is better than the cover..."
|
|
|
|
|