11 Replies - 1828 Views - Last Post: 03 January 2013 - 12:20 PM Rate Topic: -----

#1 mouse88  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 192
  • Joined: 27-July 10

Application Not Working After Target Framework Change

Posted 02 January 2013 - 01:57 PM

I changed the target framework for my project from 4.5 to 3.5. I had a few errorr messages about the Microsoft.CSharp reference so I changed the framework back to 4.5. Now when I run the application the first form is just dead and doesn't seem to do anything. My first form has a progess bar which is updated using a timer but it doesn't update just stays as it is and nothing happens.

Any ideas?

Regards
Matt
Is This A Good Question/Topic? 0
  • +

Replies To: Application Not Working After Target Framework Change

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5676
  • View blog
  • Posts: 12,194
  • Joined: 02-June 10

Re: Application Not Working After Target Framework Change

Posted 02 January 2013 - 02:00 PM

View Postmouse88, on 02 January 2013 - 02:57 PM, said:

Any ideas?


Uhhhhh.... You haven't done any debugging??????????

mouse88: What this shows us is that you aren't familiar with breakpoints and how to debug your own code.


tlhIn`toq's FAQ list

Learning to debug one's own code is an essential skill. Sadly, one that apparently few college courses teach. Silly if you ask me.

Placing breakpoints and walking through the code line by line allows you to actually WATCH it execute.

Visualizing what your code does will let you see why it behaves the way it does.

It would be well worth your time to do the tutorials on FAQ 2. A couple hours learning this skill will save you hundreds of hours of confusion in one project alone.


TOP most asked:
What does this error message mean?
FAQ 2: How do I debug
FAQ 3: How do I make Class1/Form1 talk to Class2/Form2


FAQ (Frequently Asked Questions - Updated DEC 2012
Spoiler



Was This Post Helpful? 0
  • +
  • -

#3 Martyr2  Icon User is online

  • Programming Theoretician
  • member icon

Reputation: 4423
  • View blog
  • Posts: 12,293
  • Joined: 18-April 07

Re: Application Not Working After Target Framework Change

Posted 02 January 2013 - 02:02 PM

Well I haven't known switching target frameworks to just break code that worked before at that specific target level. Have you tried some debugging in the timer to make sure the timer is still executing? That is where I would start my search for a solution. If you know the timer is working then it is something about the progress bar being called on that is probably the problem.

Maybe you can show us the code involving the timer and progress bar? ;)
Was This Post Helpful? 0
  • +
  • -

#4 mouse88  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 192
  • Joined: 27-July 10

Re: Application Not Working After Target Framework Change

Posted 02 January 2013 - 02:22 PM

Firsty I do know how to use breakpoints and debug my code.

The app does not throw any exceptions when running it however if I publish and install it it gives the error in the attached image.

I have put a breakpoint on the load event of my startup form. The event fires and proceeds to call the first void which loads some user data in to a data table. After completing this it shows the form and just stops doing anything.

Based on the error message and the method that it seems to hang on I assume it is something to do with accessing the database however I didn't have this problem before I changed the framework.

If I look at the count of the rows in the data table it states "Cannot evaluate expressionbe becuase a native frame is on top of the call stack".

Regards
Matt

Attached image(s)

  • Attached Image

Was This Post Helpful? 0
  • +
  • -

#5 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5676
  • View blog
  • Posts: 12,194
  • Joined: 02-June 10

Re: Application Not Working After Target Framework Change

Posted 02 January 2013 - 02:32 PM

Hit that button marked "details" - it will tell you a lot

Quote

After completing this it shows the form and just stops doing anything.


Keep F-10'ing to this point. I bet you find its caught in some kind of loop so it can't respond.

You mentioned a progress bar. You did put that in its own thread, didn't you?

Quote

I changed the target framework for my project from 4.5 to 3.5.

You do have backups of the project, right? Did you make a backup before making this big change?
How far back is your most recent backup? It might be faster to re-code an hour worth of lost code than to track down this elusive issue over 3 hours.
Was This Post Helpful? 0
  • +
  • -

#6 mouse88  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 192
  • Joined: 27-July 10

Re: Application Not Working After Target Framework Change

Posted 02 January 2013 - 02:50 PM

Here's what I get if it hit details:

Spoiler


Stupidly I did not back up the project so I have no choice but to try and fix.

It doesn't allow me to F10 any further it just shows the form as does nothing.

This post has been edited by tlhIn`toq: 02 January 2013 - 03:08 PM
Reason for edit:: LONG details put into spoiler tag

Was This Post Helpful? 0
  • +
  • -

#7 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5676
  • View blog
  • Posts: 12,194
  • Joined: 02-June 10

Re: Application Not Working After Target Framework Change

Posted 02 January 2013 - 03:08 PM

Attached Image

So now you have to start debugging the form_load handler. You can see it gets that far.

Right after the form loads you have the frmLogin .Load event - from the ChangeLog class????
Then you load user data. All of these methods should have breakpoints at the start to see if they are being hit and so you can F-10 your way through them.

So I suspect if you breakpoint somewhere in the form creation or load you should see the change log calls... then F-11 your way into the LoadUserData() method and take it from there
Was This Post Helpful? 0
  • +
  • -

#8 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3818
  • View blog
  • Posts: 13,534
  • Joined: 12-December 12

Re: Application Not Working After Target Framework Change

Posted 02 January 2013 - 03:36 PM

I might be missing something.. but can you not just use Project, Add Reference and add a reference to the ACE-OLEDB (COM) object library? These references are specific to the Framework you are targetting.

This post has been edited by andrewsw: 02 January 2013 - 03:38 PM

Was This Post Helpful? 0
  • +
  • -

#9 CodingSup3rnatur@l-360  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 992
  • View blog
  • Posts: 972
  • Joined: 30-September 10

Re: Application Not Working After Target Framework Change

Posted 02 January 2013 - 03:41 PM

Handler methods for a form's Load event have the tendency to swallow exceptions when debugging on a x64 OS. It seems like you might be encountering this problem from how you describe how nothing happens when you step through the Load event handler method.

If that is the case, that suggests you are using a x64 bit OS, in which case you could try setting the the platform/build target of your application to x86 (Right click on project -> Properties -> Build) , as I think that often solves this issue.

EDIT: Or, for a more general solution(s), have a look here.

This post has been edited by CodingSup3rnatur@l-360: 02 January 2013 - 03:58 PM
Reason for edit:: Added link to more general solution.

Was This Post Helpful? 0
  • +
  • -

#10 mouse88  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 192
  • Joined: 27-July 10

Re: Application Not Working After Target Framework Change

Posted 03 January 2013 - 11:55 AM

Quote

I might be missing something.. but can you not just use Project, Add Reference and add a reference to the ACE-OLEDB (COM) object library? These references are specific to the Framework you are targetting.


I may also be missing something as I don't see this as an available reference to select?

Quote

If that is the case, that suggests you are using a x64 bit OS, in which case you could try setting the the platform/build target of your application to x86 (Right click on project -> Properties -> Build) , as I think that often solves this issue.


I am using a x64 bit OS, I changed my app to x86 and it runs fine from visual studio but hangs the same as before if I publish and install it.

The computer that I will be using it on wont be running a x64 but OS so hopefully it will work.

I will try debugging it again putting breakpoints at the start of each method to try and pinpoint where it hangs. It seems to be where I am running the query using the table adapter but the exception is getting swallowed up so it just shows the from and stops executing the code.

Never had this problem before after just changing the target framework but then again i've never had a x64 OS until I got this laptop.

This post has been edited by mouse88: 03 January 2013 - 11:56 AM

Was This Post Helpful? 0
  • +
  • -

#11 mouse88  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 192
  • Joined: 27-July 10

Re: Application Not Working After Target Framework Change

Posted 03 January 2013 - 12:07 PM

I have now managed to get this working after publishing it by going in to build, setting it to 'Any CPU' and checking prefer 32-bit.

I assume this is forcing it to run on 32-bit on my laptop but I may be wrong.

I suppose I could say this is fixed but wish I understood why it broke in the first place.

Thanks for the help.

Matt
Was This Post Helpful? 0
  • +
  • -

#12 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3662
  • View blog
  • Posts: 11,467
  • Joined: 05-May 12

Re: Application Not Working After Target Framework Change

Posted 03 January 2013 - 12:20 PM

As I recall, most OLEDB drivers are 32-bit only. When your program is compiled with AnyCPU, the JIT detects an x64 OS, and so it will compile your code as x64. When your code tries to load the OLEDB driver, a 64-bit process isn't allowed to load in a 32-bit DLL directly. (You'll have to setup some thunking if you want to do this, but this is usually not in the scope of most .NET programs.)

I'm guessing that by flipping targeted frameworks, Visual Studio (or your IDE) tried to help you out by switching to AnyCPU targets. If you were using source control or backing up your work, you would be able to compare against your past working (and non-working) versions to see what changed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1