From: Saga on
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



From: Tom Shelton on
On 2010-04-27, Saga <antiSpam(a)nowhere.com> 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
From: Saga on
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" <tom_shelton(a)comcastXXXXXXX.net> wrote in message
news:Oj%23irXk5KHA.1888(a)TK2MSFTNGP05.phx.gbl...
> On 2010-04-27, Saga <antiSpam(a)nowhere.com> 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


From: Saga on
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" <antiSpam(a)nowhere.com> wrote in message
news:%23Xz9t4j5KHA.3804(a)TK2MSFTNGP05.phx.gbl...
> 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
>
>
>


From: Armin Zingler on
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