QuoteReplyTopic: Generated partial class files problem Posted: 09-Nov-2009 at 1:05pm
This has happened to me twice now. I'm developing along nicely when all of a sudden, most of my partial class files are gone. There are still references to them in the project, so I get lots of compiler errors when I go to compile. If I go to the Object Mapper and try to save (hoping to regenerate them), I get the following error message:
--------------------------- Save File Error --------------------------- Failed to save model file: 'C:\_ProModel\Development\EPS\Current\ObjectModel\DevForce\EPS.ObjectModel.DevForce.ibedmx'.
The specified version number is invalid. --------------------------- OK ---------------------------
So I'm stuck. The first time this happened, I reconstructed everything from scratch. Obviously, I shouldn't be expected to do this each time this happens. Any ideas as to what is happening and what I can do? I wasn't even doing anything with DevForce directly, like using the Object Mapper or anything. Just coding and suddenly, boom. Any (timely) help would be greatly appreciated.
I asked around, and none of us has seen anything like this, but here are some questions people suggested I ask:
1. Are you running other Visual Studio add-ins? If so, which?
2. Do you have multiple .csproj files in a single directory? It is possible that this could confuse the Object Mapper.
3. (Unfortunately you'd have to wait till it happens again to do this
one.) Look at the DevForce output pane in VS to see if any messages
were written there.
As I recall you also had some issue with some of the Learning Resources not getting installed properly. Did you ever get that corrected? I'm asking not because of any intrinsic importance of those, but that's another problem we haven't seen and I'm just wondering if something isn't just hosed in your computing environment. I still remember some of the SQL Server 2008 betas not uninstalling properly or completely and creating some issues (but only with subsequent editions of SQL server) that were quite difficult to straighten out. I haven't seen problems like that in the last couple of years. [1]
I'm just mentioning this so that you think about (or share) any unusual stuff you installed that might be related to or used by Visual Studio.
You are right, I've been having minor install issues as well. I upgraded to the latest version (after my previous forum postings) and now when I click on my Learning Resources, it brings me to an htm page where all of the links are broken (even the images). I have no idea what is going on, but it definitely seems like there is something wrong with my environment, though I don't seem to have issues with anything else.
Some info that may be relevant: I'm running 32-bit Windows Vista Business, SP2, and have both VS 2005 and VS 2008 installed. And to answer your questions, the only other add-in I have is for TestTrack (our defect tracking software), no multiple .csproj files that I can find, and I didn't know there was a DevForce output pane. That also reminds me - I've never had a 'DevForce' tree item under the 'C#' node when I open the 'New Project' dialog (another install issue?).
Fortunately, I've been on the brink of reformatting my computer and upgrading to Windows 7, so I think it's finally time. I'll let you know if I happen to have any of these issues after doing so.
Reformatting your computer and starting over ordinarily solves a host
of problems (such as what to do for the next two days 8-) ).
On
the other hand, if your machine is a laptop, I'll just pass on the info
that we've had two (out of two) of those in our shop literally fry
themselves by overheating after an upgrade from Vista to Windows 7.
This didn't happen immediately - it took 2 or 3 months, but certainly
if my machine were a laptop and I upgraded from Vista to Windows 7, I'd
watch very carefully for the machine running hot.
We haven't seen the problem with desktops, which, of course, have bigger fans and better airflow.
Okay, so I've upgraded to Windows 7 (and when I say upgraded, I mean I backed up my files, repartitioned my drives, and installed a fresh version of Windows 7 Enterprise). After getting most everything installed again, I'm happy to say that my installation of DevForce looks much better - there are DevForce project templates and the Learning Resources looks intact. So I recreated my EF entity data model and my DevForce projects, and got my application running again. Things were looking pretty good, until about 10 minutes ago when all of sudden, most of my partial class files disappeared again and (you guessed it) the Object Mapper is once again telling me:
--------------------------- Save File Error --------------------------- Failed to save model file: 'C:\_ProModel\Development\EPS\Current\ObjectModel\DevForce\EPS.ObjectModel.DevForce.ibedmx'.
The specified version number is invalid. --------------------------- OK ---------------------------
I have absolutely no idea what I can do here. I do have a laptop, but have not had any overheating issues (as far as I know). The only other bad thing that I can think of that happens to me but doesn't seem to happen to anyone else is about 30-40% of the time when I stop debugging in VS, it hangs and I have to wait about 20 seconds for VS to prompt me to stop debugging. When I do, my application process keeps running and I have to shut down VS to free the process and then relaunch my solution. It's extremely annoying and after installing Windows 7, it still seems to do it occassionally. Other than that, my computer seems to run just fine.
Terry - This is indeed mysterious. FIRST - ARE YOU USING SOURCE CONTROL. If "no", STOP DO NOT PASS GO. You should not be re-doing anything. When the wheels come off, you should be able to roll back to a safe state. That's just 101.
Next, I would turn off partial class generation in the Object Mapper (why is it even on?). This is a feature of dubious utility anyway (in my opinion); it is a legacy from our classic product. You should only ever create partial class files explicitly and when needed. OM generation of partial class files does nothing for you (again, in my opinion).
I don't understand "partial class files disappeared". DevForce will not touch your partial class files. Never has, never will. As you noted, DevForce Object Mapper wasn't running when your files "disappeared". This is not sounding like a DevForce issue. I'm really not passing the buck. There is nothing in your story that involves DevForce. You get the error when you run the Object Mapper AFTER the files have already disappeared. I don't have a clue what is killing them ... or seemingly corrupting your ibedmx.
You mentioned that "some" files disappeared. Really? Some? Not others? Is there a pattern there?
Is anyone else on your team having this experience.
Clearly I am out of ideas; nothing in your account explains what is happening. So I return to the critical role of source control to help you recover. And I have to ask you to watch more closely what is going on leading up to the failure. With the help of source control you should be able to examine the differences between the before and after state (including in the ibedemx and the EF edmx which may have become corrupted too).
Happy to help when we have something more definitive to work with.
Let me answer some of your questions and then share some things that I've discovered.
Hehe, source control. Well, this is obviously a new project and I was literally minutes away from adding everything to our source control when my partial classes were deleted. So yes, I completely agree with you and will make sure to use source control sooner rather than later.
After speaking to our other team (who have been using DevForce for a while now) about the problems I've been having, the only thing that stood out as different between how we were doing things was indeed the partial class generation - they don't, I did. So when I say my partial class files disappeared, what I mean is that most, but not all, of the auto-generated partial class files simply disappeared at some point, but references to the files still existed in my full .NET and Silverlight DevForce projects, resulting in them suddenly failing to compile. I didn't pay really close attention, but it did appear that the same set of files went missing before and after my upgrade to Windows 7. However, I cannot see any particular pattern in the ones that were deleted.
So I've done some more playing around and discovered some things. I decided to see what would happen if I just got the projects compiling again, so I removed the references to the missing partial class files and when I built, I discovered that the AssemblyInfo.cs file was also missing (from the same, full .NET DevForce project), which I found very interesting. So I went into the project properties and regenerated the AssemblyInfo. Once I did this, I could compile and run again, and also discovered that the Object Mapper could save again. (I had tried lots of stuff previously to try to get the Object Mapper to save, like recreating the EF entity data model and deleting the ibedmx file and regenerating, all with no luck, since I never managed to track the issue to the missing AssemblyInfo.)
So now, at least, I know how to get back to a runnable state and I've made sure to turn off the partial class generation (btw, I find it humorous that you call one of own features dubious ;). The last major remaining question is, what the heck is deleting these files? I'm certainly not convinced that it has anything to do DevForce, but you can see why I might still be suspicious. I've never even heard of anything like this until I installed DevForce, and it's only happening to my DevForce project - none of my many other projects.
At any rate, I will report on any additional findings as I move forward. Thanks for the support.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum