473,671 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Asse mbly.GetExecuti ngAssembly.Loca tion, ".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.Asse mbly.GetExecuti ngAssembly.Loca tion, ".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 1502
Hi,

Try this instead.

iniFileName =
Replace(System. Reflection.Asse mbly.GetEntryAs sembly.Location , ".exe",
".ini")

Ken
-----------------
"Ryan Gaudet" <Ry********@dis cussions.micros oft.com> wrote in message
news:B8******** *************** ***********@mic rosoft.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.Asse mbly.GetExecuti ngAssembly.Loca tion, ".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.Asse mbly.GetExecuti ngAssembly.Loca tion, ".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********@dis cussions.micros oft.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.Asse mbly.GetExecuti ngAssembly.Loca tion,
".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.Asse mbly.GetExecuti ngAssembly.Loca tion,
".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.Reflecti on.Assembly.Get ExecutingAssemb ly.Location, _
".ini" _
)

Armin

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

iniFileName =
Replace(System. Reflection.Asse mbly.GetEntryAs sembly.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********@dis cussions.micros oft.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.Asse mbly.GetExecuti ngAssembly.Loca tion,
".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.Asse mbly.GetExecuti ngAssembly.Loca tion,
".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.Reflecti on.Assembly.Get ExecutingAssemb ly.Location, _
".ini" _
)

Armin

Nov 21 '05 #5

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

Similar topics

8
2356
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 - the included file depends on the language. Atm I'm editing those file manually. Luckily atm it's only two languages I have to work with, but even in this case I forget to add a variable that I added in the other file, forget to use entities .....
9
2312
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. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER // EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
5
1350
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 character of the first line of the page. I really felt this was likely my own bug. In a DEBUG build now I captured data from the page and wrote the result for each page to the debug window. The result was consistent with the release build, and...
18
2957
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 perldb) or "run" (gdb) command. I was pleasantly pleased discover how easy though it was patch pdb.py and pdb.doc; my patch for this is here: http://sourceforge.net/tracker/index.php?func=detail&aid=1393667&group_id=5470&atid=305470
5
2906
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 trimming that substring off the original string, perhaps this is more clear in code. In any event, what I have works fine for strings like "23 1 23452 34" and even "1/2 2/3 3/4 4/5" but if the string looks like "1/2 -2/3 3/4 -4/5" the original string...
17
1678
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 I wann't modifying it.
148
5503
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
1598
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 app isnt finished and theres still a lot of things it gets wrong. the processing is so complex its hard to determine where the difference can be occuring, its a visual display of 3d models, and theres a couple of surfaces
9
2970
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 passes a correct integer to a webservice but when the database contains a decimal value a '0' value is received. I thought the data type (originally Int64) for the variable assignment was the problem but changing to 'decimal', 'double', or 'float' does...
0
8483
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8401
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8603
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8673
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7444
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6236
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5703
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4416
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.