Hi,
I hope somebody can help me out, Im looking for a way to retreive the
original filename & line number of a Reflection.Memb erInfo instance. Ill
provide some background on what it is that im doing:
I have an attribute defined as follows:
[AttributeUsage( AttributeTarget s.Class | AttributeTarget s.Constructor |
AttributeTarget s.Enum | AttributeTarget s.Interface | AttributeTarget s.Method
| AttributeTarget s.Property | AttributeTarget s.Struct,AllowM ultiple=true)]
public class CodeAttribute : Attribute
....
This attribute is a base for a few others, but that is not important. The
important part is that derivatives of this attrtibute can be attached to
almost all elements within code.
I am using reflection to recursively look for these attributes on items in
an assembly, when one is found some business logic takes place, and the end
result is that events are raised to the client application. This event
contains an instance of Reflection.Memb erInfo (so that would be a Type,
ConstructorInfo , MethodInfo - all derivatives of MemberInfo).
What I really need is the original filename (c:\path\file.c s) and line
number of that MemberInfo. as I am adding results of the events to the
VS.NET tasklist. I understand that this could only possible with pdb output,
and that is no problem for me whatsoever.
I have managed to do this, but in an entirely unacceptable way. I achieved
this by using EnvDTE to write a Solution wrapper class which looked through
the code in the IDE and stored each class/method/property etc in a type-safe
collection. I then developed the hack of all hacks to convert a
MemberInfo --> formetted string --> lookup Solution wrapper.
What i'd like is a way to use StackTrace or StackFrame for this, so far ive
only found examples of getting line number and file for exceptions.
TIA
JamieC 0 1466 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Edward K. Ream |
last post by:
Am I reading pep 277 correctly? On Windows NT/XP, should filenames always
be converted to Unicode using the mbcs encoding? For example,
myFile = unicode(__file__, "mbcs", "strict")
This seems to work, and I'm wondering whether there are any other details to
consider.
My experiments with Idle for Python 2.2 indicate that os.path.join doesn't
work as I expect when one of the args is a Unicode string. Everything
|
by: Edd Dawson |
last post by:
Hi. I have a strange problem involving the passing of command line
arguments to a C program I'm writing. I tried posting this in
comp.programming yesterday but someone kindly suggested that I'd have
better luck here. So here goes!
My program ignores any command line arguments, or at least it's
supposed to. However, when I pass any command line arguments to the
program, the behaviour of one of the functions changes mysteriously. I
have...
|
by: Ken Varn |
last post by:
I want to be able to determine my current line, file, and function in my C#
application. I know that C++ has the __LINE__, __FUNCTION__, and __FILE___
macros for getting this, but I cannot find a C# equivalent. Any ideas?
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
varnk@diebold.com
|
by: Arun Bhalla |
last post by:
Hi,
I'm developing an Explorer bar using VS.NET 2003 (C#) on Windows XP. For
some time, I've noticed that I don't have filenames and line numbers
appearing in my exceptions' stack traces. On the other hand, debugging with
breakpoints, etc. seems to work fine in VS.NET 2003. I can't understand why
this isn't working -- and I think it used to work, perhaps under VS.NET
2002, but maybe not. The information doesn't appear in exceptions...
|
by: QQ |
last post by:
I am trying to use reflection to access the private property of
OpenFileDialog fileNames property. I have the following code :
filedlg.InitialDirectory = directory.Text;
filedlg.Filter = "xml files (*.xml)|*.xml" ;
filedlg.FileName = "*.xml";
filedlg.ValidateNames = false;
if (filedlg.ShowDialog() == DialogResult.Cancel)
| |
by: Ken Swanson |
last post by:
Hi,
In VB.NET, how do I determine what filename has been dropped into a ListView?
In my ListView's DragEnter() event, I am trying this, which according to the Help,
should work:
MyFilename = e.Data.GetData("FileName").ToString
I have also tried e.Data.GetData(DataFormats.Text) and GetData(System.String)...
neither work. I keep getting "System.String" back as the filename.
|
by: Doug Handler |
last post by:
Ok,
I think this is my last one - in my app, the user can select via a dialog
box the dll's they want to load. I use a checkbox to track this (no worries
there), but, once a dll has been bound, how can i make sure that during the
session that a dll can't be bound twice? I'm assuming there's "protection"
w/i the reflection process to stop this, (if so, is there an exception that
is thrown? ), if not, what can i do to stop this from...
|
by: IamIan |
last post by:
I searched the archives but couldn't find anyone else with this
problem. Basically I'm grabbing all ASCII files in a directory and
doing geoprocessing on them. I need to calculate a z-factor based on
the latitude of the ASCII file being worked on, which is in the
filename. If I type in the code manually it works and reads the
latitude value from the ASCII filename, but when run within ArcGIS it
crashes when it gets to int(LatString)....
|
by: jo3c |
last post by:
hi everybody
im a newbie in python
i need to read line 4 from a header file
using linecache will crash my computer due to memory loading, because
i am working on 2000 files each is 8mb
fileinput don't load the file into memory first
how do i use fileinput module to read a specific line from a file?
for line in fileinput.Fileinput('sample.txt')
|
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: 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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |