473,404 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Different variable results in debugger than in application

Hi,
I'm making some minor changes to a VB 6 app that I converted to VB .NET a
couple of years ago and I'm running into an issue with a function that is
seemingly returning a different result in the debugger than when I run the
exe.

The code in question is this;
iniFileName =
Replace(System.Reflection.Assembly.GetExecutingAss embly.Location, ".exe", "")
& ".ini"
This is how I had the code originally and when I run it in the debugger, I
have no problems but when I run the EXE, I get the message
c:\bin\vtexvip.exe.ini not found but it seems to be in XP Pro SP2 only. If I
run it under W2K (Where the app will be run),I have no problems. In the
debugger, the variable inifilename shows the correct value of
c:\bin\vtexvip.ini. This is driving me cookoo.
I decided to change the above code to the following;
iniFileName =
Replace(System.Reflection.Assembly.GetExecutingAss embly.Location, ".exe",
".ini")
but this doesn't work at all. Although once again, in the debugger, the
variable inifilename shows the correct value of c:\bin\vtexvip.ini.
This is just a small app and is running on W2K where the problem does not
seem to exist but eventually, I may need to run it on XP and would like to
address this issue now rather that later so if anyone has any suggestions, it
would be really appreciated.

Thanks a bunch.
Nov 21 '05 #1
4 1494
Hi,

Try this instead.

iniFileName =
Replace(System.Reflection.Assembly.GetEntryAssembl y.Location, ".exe",
".ini")

Ken
-----------------
"Ryan Gaudet" <Ry********@discussions.microsoft.com> wrote in message
news:B8**********************************@microsof t.com...
Hi,
I'm making some minor changes to a VB 6 app that I converted to VB .NET a
couple of years ago and I'm running into an issue with a function that is
seemingly returning a different result in the debugger than when I run the
exe.

The code in question is this;
iniFileName =
Replace(System.Reflection.Assembly.GetExecutingAss embly.Location, ".exe",
"")
& ".ini"
This is how I had the code originally and when I run it in the debugger, I
have no problems but when I run the EXE, I get the message
c:\bin\vtexvip.exe.ini not found but it seems to be in XP Pro SP2 only. If I
run it under W2K (Where the app will be run),I have no problems. In the
debugger, the variable inifilename shows the correct value of
c:\bin\vtexvip.ini. This is driving me cookoo.
I decided to change the above code to the following;
iniFileName =
Replace(System.Reflection.Assembly.GetExecutingAss embly.Location, ".exe",
".ini")
but this doesn't work at all. Although once again, in the debugger, the
variable inifilename shows the correct value of c:\bin\vtexvip.ini.
This is just a small app and is running on W2K where the problem does not
seem to exist but eventually, I may need to run it on XP and would like to
address this issue now rather that later so if anyone has any suggestions,
it
would be really appreciated.

Thanks a bunch.
Nov 21 '05 #2
"Ryan Gaudet" <Ry********@discussions.microsoft.com> schrieb
Hi,
I'm making some minor changes to a VB 6 app that I converted to VB
.NET a couple of years ago and I'm running into an issue with a
function that is seemingly returning a different result in the
debugger than when I run the exe.

The code in question is this;
iniFileName =
Replace(System.Reflection.Assembly.GetExecutingAss embly.Location,
".exe", "") & ".ini"
This is how I had the code originally and when I run it in the
debugger, I have no problems but when I run the EXE, I get the
message
c:\bin\vtexvip.exe.ini not found but it seems to be in XP Pro SP2
only. If I run it under W2K (Where the app will be run),I have no
problems. In the debugger, the variable inifilename shows the
correct value of
c:\bin\vtexvip.ini. This is driving me cookoo.
I decided to change the above code to the following;
iniFileName =
Replace(System.Reflection.Assembly.GetExecutingAss embly.Location,
".exe", ".ini")
but this doesn't work at all. Although once again, in the debugger,
the variable inifilename shows the correct value of
c:\bin\vtexvip.ini. This is just a small app and is running on W2K
where the problem does not seem to exist but eventually, I may need
to run it on XP and would like to address this issue now rather that
later so if anyone has any suggestions, it would be really
appreciated.


Maybe the upper/lower case does not match on different machines? ".exe",
".Exe" etc.
There shouldn't be a difference because, in opposite to VB6, the code is
compiled to an Exe even when started from the debugger and not interpreted
anymore.
Try
iniFileName = System.IO.Path.ChangeExtension( _
System.Reflection.Assembly.GetExecutingAssembly.Lo cation, _
".ini" _
)

Armin

Nov 21 '05 #3
"Ken Tucker [MVP]" <vb***@bellsouth.net> schrieb:
Try this instead.

iniFileName =
Replace(System.Reflection.Assembly.GetEntryAssembl y.Location, ".exe",
".ini")


I would use the according methods of the 'System.IO.Path' class to remove
and replace the exension. Otherwise the code will fail if the path contains
".exe" somewhere in a folder name.

Just my 2 Euro cents...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4
After changing the code to use the System.IO call instead, it appears to be
working.
Thanks a bunch for your quick responses.
Ryan

"Armin Zingler" wrote:
"Ryan Gaudet" <Ry********@discussions.microsoft.com> schrieb
Hi,
I'm making some minor changes to a VB 6 app that I converted to VB
.NET a couple of years ago and I'm running into an issue with a
function that is seemingly returning a different result in the
debugger than when I run the exe.

The code in question is this;
iniFileName =
Replace(System.Reflection.Assembly.GetExecutingAss embly.Location,
".exe", "") & ".ini"
This is how I had the code originally and when I run it in the
debugger, I have no problems but when I run the EXE, I get the
message
c:\bin\vtexvip.exe.ini not found but it seems to be in XP Pro SP2
only. If I run it under W2K (Where the app will be run),I have no
problems. In the debugger, the variable inifilename shows the
correct value of
c:\bin\vtexvip.ini. This is driving me cookoo.
I decided to change the above code to the following;
iniFileName =
Replace(System.Reflection.Assembly.GetExecutingAss embly.Location,
".exe", ".ini")
but this doesn't work at all. Although once again, in the debugger,
the variable inifilename shows the correct value of
c:\bin\vtexvip.ini. This is just a small app and is running on W2K
where the problem does not seem to exist but eventually, I may need
to run it on XP and would like to address this issue now rather that
later so if anyone has any suggestions, it would be really
appreciated.


Maybe the upper/lower case does not match on different machines? ".exe",
".Exe" etc.
There shouldn't be a difference because, in opposite to VB6, the code is
compiled to an Exe even when started from the debugger and not interpreted
anymore.
Try
iniFileName = System.IO.Path.ChangeExtension( _
System.Reflection.Assembly.GetExecutingAssembly.Lo cation, _
".ini" _
)

Armin

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Sebastian Kerekes | last post by:
Greetings, I'm developing an application that supports multiple languages. In my XSL I use variables to place the text where it belongs to. At the top of the document I include those variables -...
9
by: RalphTheExpert | last post by:
I'm getting different behavior if my code is running under the debugger or not. I have modified Winmain to look like this: // Copyright (C) 2002 Microsoft Corporation // All rights reserved....
5
by: Lee Gillie | last post by:
A surprising, and unexplained behavior was seen from a RELEASE build of a VB application (essentially a console app). It processes thousands of pages of text, and occasionally drops the first...
18
by: R. Bernstein | last post by:
Okay, a bit of an exaggeration. Recently, I've been using Python more seriously, and in using the debugger I think one of the first things I noticed was that there is no "restart" ("R" in...
5
by: CarlWSummers | last post by:
I'm doing something wrong. I'm parsing a string into rational numbers (int/int) by looking for spaces in the string, assinging a substring of the original string to a temporary variable, and...
17
by: GinTon | last post by:
How to access to a variable (that value is not returned) from a module imported? And the variable is set at the module-level. That module is external to my program, it's from another project so...
148
by: onkar | last post by:
Given the following code & variable i . int main(int argc,char **argv){ int i; printf("%d\n",i); return 0; } here i is allocated from bss or stack ?
12
by: colin | last post by:
Hi, Ive got a difference in results depending on wether I run my app in the debugger, or run it seperatly (or with <ctrl-f5>) the results in the debugger seem to be more correct, although the...
9
by: jpoe | last post by:
I have adopted this Code from an application built by consultants. My company needs to now pass decimal values for the 'discountRate' variable below. Using the debugger I receive and the program...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.