PC Review


Reply
Thread Tools Rate Thread

Can't evaluate expressionin IDE debug mode

 
 
Saga
Guest
Posts: n/a
 
      27th Apr 2010
So I am stepping through my program and I either hover
or select an expression and hit F9 and its value is displayed,
but then in some cases I get this message:

"Cannot evaluate expression because we are stopped in a
place where garbage collection is impossible, possibly because
the code of the current method may be optimized."

I searched for it and got various hits, some of them useful,
but not enough to solve my problem. I have never encountered
this message before. The only difference for this specific routine
is that I copied and pasted it from a VB6 project. Initially it had
lots of errors (102 to be exact), but I changed the code accordingly
and got it down to 0 errors.

For example, I get the message on this line:

begin.dteBegDate = DateSerial(CInt(strAr(2).Substring(strAr(2).Length() - 2,
2)), _
CInt(strAr(2).Substring(0, 2)),
CInt(strAr(2).Substring(2, 2)))

Where strAr(2) is "042710". If I highlight any of the following line and hit
F9 I get
the message:

strAr(2).Substring(strAr(2).Length() - 2, 2)
or
cint(strAr(2).Substring(strAr(2).Length() - 2, 2))
or
BData.dteBegDate

But if I highlight the following line I get the value correctly:

BData.strVehicleId = strAr(4).Trim()

BData is a structure. I already checked the JIT suppress option as
recommended
by the information that I found, but this does not seem to be the issue. I
suspect
that some of my .NET code may not be up to spec. Any suggestions are
welcomed.
Thank you, Saga



 
Reply With Quote
 
 
 
 
Tom Shelton
Guest
Posts: n/a
 
      27th Apr 2010
On 2010-04-27, Saga <(E-Mail Removed)> wrote:
> So I am stepping through my program and I either hover
> or select an expression and hit F9 and its value is displayed,
> but then in some cases I get this message:
>
> "Cannot evaluate expression because we are stopped in a
> place where garbage collection is impossible, possibly because
> the code of the current method may be optimized."
>


Are you stepping through in debug mode? There are various things that will
not work properly if you are steping through in Release mode...

--
Tom Shelton
 
Reply With Quote
 
Saga
Guest
Posts: n/a
 
      27th Apr 2010
Thank you for the reply. I could not find where to verify the
mode that my project was in. Ifianlly found that the "Show
advanced build configurations" checkbox needed to be
checked :-) Anyways, I checked and the rpojcect is in
Debug mode. Regards, Saga


"Tom Shelton" <(E-Mail Removed)> wrote in message
news:Oj%(E-Mail Removed)...
> On 2010-04-27, Saga <(E-Mail Removed)> wrote:
>> So I am stepping through my program and I either hover
>> or select an expression and hit F9 and its value is displayed,
>> but then in some cases I get this message:
>>
>> "Cannot evaluate expression because we are stopped in a
>> place where garbage collection is impossible, possibly because
>> the code of the current method may be optimized."
>>

>
> Are you stepping through in debug mode? There are various things that
> will
> not work properly if you are steping through in Release mode...
>
> --
> Tom Shelton



 
Reply With Quote
 
Saga
Guest
Posts: n/a
 
      28th Apr 2010
Any chance that using Dateserial() function could be causing
this? Is there a better way to assign a date value to a date
variable when I have the year, month and day in separate
integer variables? Saga


"Saga" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> So I am stepping through my program and I either hover
> or select an expression and hit F9 and its value is displayed,
> but then in some cases I get this message:
>
> "Cannot evaluate expression because we are stopped in a
> place where garbage collection is impossible, possibly because
> the code of the current method may be optimized."
>
> I searched for it and got various hits, some of them useful,
> but not enough to solve my problem. I have never encountered
> this message before. The only difference for this specific routine
> is that I copied and pasted it from a VB6 project. Initially it had
> lots of errors (102 to be exact), but I changed the code accordingly
> and got it down to 0 errors.
>
> For example, I get the message on this line:
>
> begin.dteBegDate = DateSerial(CInt(strAr(2).Substring(strAr(2).Length() -
> 2, 2)), _
> CInt(strAr(2).Substring(0, 2)),
> CInt(strAr(2).Substring(2, 2)))
>
> Where strAr(2) is "042710". If I highlight any of the following line and
> hit F9 I get
> the message:
>
> strAr(2).Substring(strAr(2).Length() - 2, 2)
> or
> cint(strAr(2).Substring(strAr(2).Length() - 2, 2))
> or
> BData.dteBegDate
>
> But if I highlight the following line I get the value correctly:
>
> BData.strVehicleId = strAr(4).Trim()
>
> BData is a structure. I already checked the JIT suppress option as
> recommended
> by the information that I found, but this does not seem to be the issue. I
> suspect
> that some of my .NET code may not be up to spec. Any suggestions are
> welcomed.
> Thank you, Saga
>
>
>



 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      28th Apr 2010
Am 28.04.2010 20:32, schrieb Saga:
> Any chance that using Dateserial() function could be causing
> this?


Can't answer this one but...

> Is there a better way to assign a date value to a date
> variable when I have the year, month and day in separate
> integer variables?


d = New Date(year, month, day)

--
Armin
 
Reply With Quote
 
Saga
Guest
Posts: n/a
 
      28th Apr 2010
Thanks! I'll make that change. Saga

"Armin Zingler" <(E-Mail Removed)> wrote in message
news:%23Sz%(E-Mail Removed)...
> Am 28.04.2010 20:32, schrieb Saga:
>> Any chance that using Dateserial() function could be causing
>> this?

>
> Can't answer this one but...
>
>> Is there a better way to assign a date value to a date
>> variable when I have the year, month and day in separate
>> integer variables?

>
> d = New Date(year, month, day)
>
> --
> Armin



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
My application takes up 1.5GB of memory in release mode, but only 370mb in debug mode...why? John Sheppard Microsoft Dot NET 4 16th Jan 2008 11:16 AM
My application takes up 1.5GB of memory in release mode, but only 370mb in debug mode...why? John Sheppard Microsoft VB .NET 4 16th Jan 2008 11:16 AM
User Control access fails in debug mode, works in release mode rbg Microsoft C# .NET 0 17th Jan 2007 10:51 PM
User Control access fails in debug mode, works in release mode rbg Microsoft ASP .NET 0 17th Jan 2007 10:51 PM
How to tell if your C# code is running in debug mode (debug compil =?Utf-8?B?TWF4IE0uIFBvd2Vy?= Microsoft C# .NET 3 20th Oct 2005 10:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:26 AM.