Suddenly, in a VB2005 project I am working on, several variables show
up in the list of warnings are being unused local variables. But they
all are. Several of them are the ex variable used in a Try/Catch, and
the Catch for each one references the ex exception variable. Yet it is
still flagged as unused? What gives? 12 9603
Are you referencing the exception variable in the catch block? I am guessing
not, which is why it is flagged that awy.
<za***@construc tion-imaging.com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. . Suddenly, in a VB2005 project I am working on, several variables show up in the list of warnings are being unused local variables. But they all are. Several of them are the ex variable used in a Try/Catch, and the Catch for each one references the ex exception variable. Yet it is still flagged as unused? What gives?
<za***@construc tion-imaging.com> schrieb: Suddenly, in a VB2005 project I am working on, several variables show up in the list of warnings are being unused local variables. But they all are. Several of them are the ex variable used in a Try/Catch, and the Catch for each one references the ex exception variable. Yet it is still flagged as unused? What gives?
I'm not able to repro the problem you describe with the final version of VS
2005. Which veryion are you using? Does the problem even occur in a newly
created project? Could you post the code you are using? Maybe deleting the
project's "bin" and "obj" folders and recompiling solves the problem.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Zacks, Suddenly, in a VB2005 project I am working on, several variables show up in the list of warnings are being unused local variables. But they all are. Several of them are the ex variable used in a Try/Catch, and the Catch for each one references the ex exception variable. Yet it is still flagged as unused? What gives?
It is a new feature what some of us by instance (Herfried and I) are not
completly fond of.
(As far as I have seen does it work correct by the way, however it does not
know that you as human know that some situations cannot exist).
Do not try to create constructions as this.
dim mystring as string = "".
This gives only overhead.
Cor
I would not even have a Catch block if I did not reference the
exception variable.
Sure you can. It will catch all exceptions.
The following compiles just fine:
Try
Catch
End Try
It is functionally the same as
Try
Catch ex As Exception
End Try
<za***@construc tion-imaging.com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. . I would not even have a Catch block if I did not reference the exception variable.
VS 2005 Version 8.0.50727.42
I have not n oticed this situation in a new project. In fact, it just
cropped up today in a project I have been working on for the past
month.
Deleting the bin and obj folders and rebuilding did not help.
Sorry, I can't post any of the code, my company owns it. I can post the
warning the compiler tells me about these variables:
Warning 5 Unused local variable: 'KeyField'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 140 13 Universal Data Mover
Warning 6 Unused local variable: 'OrderBy'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 141 13 Universal Data Mover
Warning 7 Unused local variable: 'DerivedValue'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 143 13 Universal Data Mover
Warning 8 Unused local variable: 'StillAdding'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 148 13 Universal Data Mover
Warning 9 Unused local variable: 'DoUpdate'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 149 13 Universal Data Mover
Warning 10 Unused local variable: 'KeyChanged'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 150 13 Universal Data Mover
Warning 11 Unused local variable: 'VerificationEr rors'. C:\Documents
and Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 151 13 Universal Data Mover
Warning 12 Unused local variable: 'ex'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 253 15 Universal Data Mover
Warning 13 Unused local variable: 'ex'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 279 19 Universal Data Mover
Warning 14 Unused local variable: 'ex'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 317 19 Universal Data Mover
Warning 15 Unused local variable: 'ex'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 350 19 Universal Data Mover
Warning 16 Unused local variable: 'ex'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 431 23 Universal Data Mover
Warning 17 Unused local variable: 'ex'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 459 23 Universal Data Mover
Warning 18 Unused local variable: 'ex'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 498 23 Universal Data Mover
Warning 19 Unused local variable: 'ex'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 545 23 Universal Data Mover
Warning 20 Unused local variable: 'ex'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 765 35 Universal Data Mover
Warning 21 Unused local variable: 'ex'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 774 35 Universal Data Mover
Warning 22 Unused local variable: 'ex'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 815 51 Universal Data Mover
Warning 23 Unused local variable: 'ex'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 827 51 Universal Data Mover
Warning 24 Unused local variable: 'ex'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 935 51 Universal Data Mover
Warning 25 Unused local variable: 'ex'. C:\Documents and
Settings\zacks\ My Documents\CIS\S ourceSafe Working\Univers al Data
Mover\Universal Data Mover\Data_Engi ne.vb 946 51 Universal Data Mover
In EACH case, the variable flagged as not sure is most definitely used.
How do I get rid of the warnings?
How can one do:
dim mystring as string = ""
without the overhead you mention?
I know you can. It's just that every time I use a Try/Catch is because
I want to know what the error is.
<za***@construc tion-imaging.com> schrieb: How do I get rid of the warnings?
How can one do:
dim mystring as string = ""
without the overhead you mention?
\\\
Dim s As String = Nothing
///
However, I tend to disable the warning as it doesn't make much sense to me.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Geronimo W. Christ Esq |
last post by:
Are there any scripts or tools out there that could look recursively
through a group of C/C++ source files, and allow unreferenced function
calls or values to be easily identified ?
LXR is handy for indexing source code, and for a given function or
global variable it can show you all the places where it is referenced.
It would be really nice to have a tool that would simply list all of the
referenced functions, so that you could go...
|
by: ralphNOSPAM |
last post by:
Is there a PHP script that can find unused variables? I'd like to
'clean up' my scripts.
Thanks...
|
by: Michael B Allen |
last post by:
Is there a standard method for supressing warnings regarding unused
parameters? I have a function that might be called hundreds of thousands
of times that looks like this:
const void *
idx_byte(const void *p, int idx, void *context)
{
return (unsigned char *)p + idx;
}
|
by: Seigfried |
last post by:
There was a previous thread with this title that was closed, so I'm
starting a new one because I have exactly the same problem.
The original poster never did get a satisfactory answer because "the
problem went away as mysteriously as it arrived".
Here's a snippet from my program that illustrates the problem:
Select Case reader.Name
Case "FName"
|
by: ThazKool |
last post by:
I am just wondering if all the methods that are never called upon
during a programs execution are removed when optimizing. For example
you have:
class FooA
{
void a();
...
void z();
}
| |
by: skip |
last post by:
At work we have a fairly large application (about 20 packages, 300+ modules)
that looks like we might be heading into a bit of a plateau stage. Now
seems like a good time to identify and delete old, unused code that's flown
under the radar screen for awhile simply because nobody was looking for it.
Trouble is, most of that unused code consists of module-level classes,
functions and variables, so it's hard to distinguish mechanically from...
|
by: Rob Meade |
last post by:
Hi all,
I'm using Visual Studio 2005 and it has as you are probably aware a very
handy feature of reporting to you which variables are not being used - cool
thanks...
What would be even more handy is a way of finding out which of my methods
are being used, and across a whole project. I've entered the horrible
realms of a project going out of control and I've added bits for testing,
and now I'm having to go through the whole project,...
|
by: werasm |
last post by:
Hi all,
I'm looking for a nice clean (portable) way to get rid of unused
variable warnings without fiddling with compiler settings (on a per
case basis). I've come up with this:
template <class T>
inline void valueUsed( const T& ){}
int main()
|
by: Joris Dolderer |
last post by:
Hello,
I want to compile and link a program statically against the dietlibc. Of
course, the dietlibc includes functions my program never needs. Is
there any way to throw them out of the final executable? Is there maybe
a program that cuts them away from the source code of the dietlibc?
I am using gcc.
Joris
|
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |