|
OK. If it is only one project out of many that misbehaves, you could start over and import the source files (but not the solution or project files). If there are multiple problematic projects, something bigger is going on. You'll figure it out.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
modified on Thursday, May 20, 2010 11:25 PM
|
|
|
|
|
Well, I appreciate you taking all this time to help me. I did just what you said and created a new project, in a whole new parent folder (J:\TempProject\). I then imported .cs files after copying/pasting them to the new temp folder. I built the solution and pressed Ctrl+F5. And I waited ... and waited. Still nothing. It would make sense to me that it's somewhere in the code. On the other hand, it never even reaches the application's entry point so it isn't even executing any code in MainForm is it?
BTW, I created a couple of test projects, gave them each a 'mock' GUI that performed simple tasks, then I built them. They run fine in every method of execution. I just wanted to make sure (again) that it wasn't more than this one project causing problems.
|
|
|
|
|
So the mystery continues.
You now have two projects that act strangely, both based on the same set of source files, but created separately, so their .sln and .csproj files aren't copies? and everything else works fine?
If you have no startup object set, your app can have only one class holding a static Main() and that, as far as your code is concerned, is where your app begins.
If you have a startup object set, it defines the class whose static Main() will be the entry point.
AFAICT you have two choices now:
- slim down your app until the problem disappears, so you might discover where it really matters; most likely that ends up in a bug report, not a solution;
- or reinstall Visual.
Some more questions to better understand your set-up:
Which VS are you running?
which .NET version are you targeting?
Which Windows version are you using?
Is UAC on (I'm not suggesting you turn it off!)
Did you do special things to run from say a networked disk?
are you using anything special in the manifest file?
Here is a short experiment for you: try again on a non-removable, local disk (maybe the system disk).
You might also try on the same machine with another VS (if only one VS is installed, you could easily add another one, say an Express version that is 2 years younger/older). The only side-effect that has it the one you install last will hijack your file associations.
And you could carry the entire project to another PC and see what gives there.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
To answer your questions:
I am using Visual Studio 2008 Professional.
I am targeting the .NET Framework v2.0. I have tried v3.0 and v3.5 as well.
I am running Windows Vista Home Premium Service Pack 2.
I turned UAC off a while back.
No, I did nothing to run from a networked disk. (I have no networked disks to begin with .)
I have never touched the manifest file.
I placed the project on the local system disk (C:\ drive) with the exact same results.
I believe the only option at the moment would be slimming down the code until I find the trouble portion. But why will it ONLY not work in "Start Without Debugging" when I run it from VS via F5? That's what really puzzles me with this one. I've never once experienced this before. And it runs just fine when I execute it outside of VS or in the VS debugger. :-P
|
|
|
|
|
Thanks for the info. It tells me your system and mine are very similar; I'm running Vista too, and using VS2008 most of the time. The major difference is, I'm running with UAC.
Here is a new idea: maybe the trouble is related to static initialization; when your app runs, the classes and methods get compiled just-in-time; the first time some class is touched, its statics need created and initialized, and there could be issues about the order in which this happens, maybe race conditions even. If this hypothesis would stand, you could remove almost all code and still have the trouble, until you start simplifying the initializer stuff. Do you have static constructors at all? (i.e. classes with a constructor that is declared static).
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
No, I do not have any static constructors. I do, however, have a class (which is used to store the data needed to run the app.) which contains a few static members. Is there anything I can do to see if that class is the problem?
|
|
|
|
|
check for this pattern:
class Program {
public static Main() {
Application.Run(new MainForm());
}
}
class MainForm {
private int i=Globals.Value;
public MainForm() {
MessageBox.Show("We never get here");
...
}
...
}
class Globals {
private static j=...; <<<<<<<<<<<<<<<<<<<<<
private static Globals() {
... <<<<<<<<<<<<<<<<<<<<<
}
public static int Value {
get {
... <<<<<<<<<<<<<<<<<<<<<
}
}
}
All statements marked <<<<<<<<<<<<<<<<<<<<< will execute before you reach MessageBox.Show and could crash your app
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
The only time the static members of the class are assigned to happens after the main form loads. I am currently going through and removing the assignments to test that though. I'll be back soon with the results.
modified on Saturday, May 22, 2010 8:15 PM
|
|
|
|
|
Okay. That didn't work either. I wonder if I must re-code the project pretty much from scratch. :-P
|
|
|
|
|
have you tried another PC? another Visual?
either something in your system is broken (outside your app), or your code does something that (sometimes) fails, but then the cause should be visible in the source files. I haven't seen your code, I can't tell, but you should be able to.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Okay, I built the project in Release mode and ran it in the debugger. Success. Running it from the \Release folder, however, was a failure. Now running it from the \Debug folder won't work either.
|
|
|
|
|
So I have a dictionary with DayofWeek and Int.
I need to find out how to populate the Dictionary then with the Days and and integer increase.
for example right now I create a dictionary:
Dictionary<int,DayOfWeek> dicFindDates = new Dictionary<int,DayOfWeek>();
then I get the day of week it is for example today is "Thursday"
DayOfWeek dowStartDay = (DayOfWeek)Enum.ToObject(typeof(DayOfWeek), (int)S.StartOfWeek);
then I add to the dictionary
dicFindDates.Add(0,DayofWeek)
while (i<6)
{
dicFindDates.Add(i++,DayofWeek <------ ++????)
}
so that I get(and can change according to date):
0, Thursday
1, Friday
2, Saturday
3, Sunday
4, Monday
5, Tuesday
6, Wednesday
|
|
|
|
|
Hi,
(DayOfWeek)i should do it.
[Added]
Which also implies you don't really need a dictionary at all...
[/Added]
BTW: I recommend you use a for loop, rather than an auto-increment in the middle of a statement. And you can handle all seven days in the same way, no need to treat 0 separately.
FWIW: I have some goodies about DateTime in this article[^].
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
modified on Thursday, May 20, 2010 2:41 PM
|
|
|
|
|
I am generating a zip file and then emailing it. I am using a temp directory to create this file but i will always be creating a number of different files using this directory.
The problem i am having is when i go to delete the files inside my temp directory i get an error saying that the zip file is being used by another process.
I have stepped through the code and waited until the email was sent to be sure that its not being locked there.
I have also set the zipfile to null and that still didnt work.
if anyone has any ideas as to what might be causing this i would be forever grateful.
if (!CreatedTempFolder)
{
if (!System.IO.Directory.Exists(TempFileLocation))
System.IO.Directory.CreateDirectory(TempFileLocation);
else
{
System.IO.Directory.Delete(TempFileLocation, true);
System.IO.Directory.CreateDirectory(TempFileLocation);
}
string zipFileName = string.Format("{0}\\{1}.zip", TempFileLocation, DrSched["GROUPNAME"].ToString());
MyZip zipfile = new MyZip(zipFileName,"W");
foreach (string fileName in System.IO.Directory.GetFiles(TempFileLocation,"*.csv"))
zipfile.AddFile(fileName);
zipfile.Close();
zipfile = null;
GC.Collect();
|
|
|
|
|
If MyZip implements IDisposable (which Im willing to bet it does!) then you need to call Dispose() on it.
Setting it to null does nothing to solve the problem you're experiencing.
|
|
|
|
|
You haven't stated what zipFile is (build in .Net functionality? sharpZipLib? Other third party?) however I suspect the problem is you need to call Dispose as well as Close , so that it releases unmanaged resources, in this case the underlying file.
|
|
|
|
|
Thanks for your help i have found a work around from this i am still not 100% sure exactly what MyZip(its company specific).
Thanks for all your help !!!
Dino
|
|
|
|
|
If you are targeting .NET 3.5 or even 4.0 there is a namespace called System.IO.Packaging , which contains some classes that allow working with zip files.
Life is a stage and we are all actors!
|
|
|
|
|
Anybody know of a .net based (ideally C#) .mov (video format) file writer? If not, can anybody point me to a DLL I can use for this?
Thanks,
Chris
|
|
|
|
|
The best I can suggest is to try using ffmpeg called from within .net (http://www.ffmpeg.org/[^]).
It won't be pretty or particularly secure.
|
|
|
|
|
Thanks for the suggestion - looks a bit tricky to use from .Net, but beggars can't be choosy.
|
|
|
|
|
I am working on an application where i need to retrieve data (using query) from a Access database.(ABC.mdb)
Please provide code snippet for this.
it is helpful if you can provide sample which uses dataset .
|
|
|
|
|
|
Did you check on msdn - see here.
My signature "sucks" today
|
|
|
|
|
Thnx..
As shown in the example dataset contain data table information. Now i need to retrieve some set of data from dataset. How to do it.
Can we fire quire on the data available in the dataset.
|
|
|
|