Method RVAs: offset or VA?

dotnet framework

    Next

  • 1. Do I need Net Framework
    I am an average ordinary home user and I see this Net Framework as an update for XP. What is it used for????
  • 2. Sending data between threads
    I have a From based application that does background work in a worker thread. I want to update the form form the thread, however; the form and control instance members are not thread safe. My idea for a solution was to create my own custom windows message, P/Invoke SendMessage to send a message to the form. What I can figure out is how to send anything other than two integers of data. I need to send a string. Anyone have any ideas on how I might do this? Thanks
  • 3. query language
    Exist something like EJB query language for select data from typed dataset? Microsoft or third part library etc. thanx, l.a.
  • 4. How does one execute a C# program composed with VS IDE 2003
    F5 in the IDE will start your program in debug mode. From command line, your program is an EXE roughly like any other, you just run it. "lsr.group" < XXXX@XXXXX.COM > wrote in message news: XXXX@XXXXX.COM ... > How do I go about executing a project that I have created? I would like to > know how to do this from the Command Window as well as the IDE. > > If you can, please point out in the VS IDE 2003 documentation that describes > the method. > > Thanks > From a guy attempting to learn C#. > > >

Method RVAs: offset or VA?

Postby TWFyYyBFYWRkeQ » Tue, 28 Sep 2004 02:31:01 GMT

Greetings,

I'm writing an application that uses the Profiler API and the unmanaged 
metadata API to obtain metadata for modules from the 
ICorProfilerCallback::ModuleLoadFinished() event as well as for executables 
that I map into memory myself.  In both cases I'm able to obtain the 
IModuleInfo iface and enumerate the methods.  

I've noticed that the method RVA returned by GetMethodProps() is sometimes a 
real RVA and sometimes an offset.  This causes havok because I'm trying to 
access the method's bytecode in memory.  If its an RVA I have to call 
ImageRvaToVa(), otherwise I just have to add it to the base load address.

It seems to be treated as an offset if the CLR has loaded the module and as 
a RVA if the file was manually mapped into memory.  Is this true?  Strangely, 
Rotor always treats it as an RVA.  If you look at CorMap::ReadHeaders() in 
cormap.cpp in Rotor you'll see a magic flag called bDataMap that proves that 
RVAs have a dual nature.

Right now I have a kludge that calls ImageRvaToVa() and examines the first 
byte of the returned ptr.  If its not TinyFormat or FatFormat then I treat 
the RVA as an offset.  Is there a way, given a module's base load address, or 
perhaps a flag in the MethodProps, to determine if its RVAs are really RVAs 
or if they are offsets?

Thanks!

\\Marc

Similar Threads:

1.Error "Cast from type 'DataRowView' to type 'String' is not va

Bart,

Thank you very much. Using the DataRelation worked. I just had to specify 
the "RelationName" attribute of my DataRelation:

DataGrid1.DataSource = MyDataSet.Tables(0)
DataGrid1.DataMember = MyDataRelation.RelationName

Richard

"Bart Mermuys" wrote:

> Hi,
> 
> "Richard Mueller" < XXXX@XXXXX.COM > wrote in 
> message news: XXXX@XXXXX.COM ...
> > I've seen this problem posted several times, but have not yet seen a
> > solution.  I make a connection to a SQL database and use a DataAdapter 
> > object
> > to fill a DataSet object with several tables. A DataRelation object links 
> > the
> > tables by an ID column. I bind the parent table to a combo box and a child
> > table to a DataGrid control using a DataView object. I want the DataGrid
> > control to reflect the selection in the combo box. For the combo box,
> > DisplayMember is a text string while ValueMember is the ID field 
> > (integer).
> > In brief:
> >
> > Private Sub Form1_Load(....)
> >    ' Connect to database, populate Tables in DataSet,
> >    ' setup DataViews, and define DataRelations.
> >    Call Populate()
> >
> >    ComboBox1.DataSource = MyDataSet.Tables(0)
> >    ComboBox1.DisplayMember = MyDataSet.Tables(0).Columns(1).ColumnName
> >    ComboBox1.ValueMember = MyDataSet.Tables(0).Columns(0).ColumnName
> >    Me.BindingContext(MyDataSet.Tables(0)).Position = 0
> >
> >    Dim strFilter As String
> >    strFilter = "ID = " & ComboBox1.SelectedValue
> >    MyDataView.RowFilter = strFilter
> >    DataGrid1.DataSource = MyDataView
> > End Sub
> >
> > Private Sub ComboBox1_SelectedValueChanged(....)
> >    Dim strFilter As String
> >    If (ComboBox1.SelectedIndex <> -1) Then
> >        strFilter = "ID = " & ComboBox1.SelectedValue
> >        MyDataView.RowFilter = strFilter
> >    End If
> > End Sub
> >
> > Strangely, the code works if I comment out the
> > ComboBox1_SelectedValueChanged sub. I can hard code in Form1_Load to 
> > select
> > the first (index=0), or any other item in the combo box, and the DataGrid
> > reflects the correct item. But of course I cannot select another item in 
> > the
> > combo box and have the DataGrid reflect this. The error is raised in
> > CombBox1_SelectedValueChanged on the statement:
> >
> > strFilter = "ID = " & ComboBox1.SelectedValue
> >
> > and the error is "Cast from type 'DataRowView' to type 'String' is not
> > valid. I've tried to use ToString and CStr to no avail. I think the key is
> > that I assign a DataSource to the combo box, plus the DisplayMember and
> > ValueMember properites, then attempt to use the SelectedValue property 
> > when
> > the user makes a selection. Any ideas?
> 
> You're probely getting this error because SelectedValueChanged fires after 
> setting the ComboBox.DataSource but before you have set the 
> ComboBox.ValueMember.  So at that point SelectedValue returns a DataRowView. 
> So you could change it to:
> 
> Private Sub ComboBox1_SelectedValueChanged(....)
>   Dim strFilter As String
>   If (ComboBox1.SelectedIndex <> -1) AndAlso _
>       (ComboBox1.ValueMember<>"") Then
>        strFilter = "ID = " & ComboBox1.SelectedValue
>         MyDataView.RowFilter = strFilter
>    End If
> End Sub
> 
> BUT, if you have a DataRelation between the two DataTables, then you don't 
> need to do that, you can let the child rows be _automatically_ filtered. 
> All you have to do is bind the DataGrid to the same DataSource as the 
> ComboBox and set DataGrid.DataMember to the name of the DataRelation between 
> them:
> 
> Private Sub Form1_Load(....)
>   ' Connect to database, populate Tables in DataSet,
>   ' setup DataViews, and define DataRelations.
>   Call Populate()
> 
>    ComboBox1.DataSource = MyDataSet.Tables(0)
>    ComboBox1.DisplayMember = MyDataSet.Tables(0).Columns(1).ColumnName
>    ComboBox1.ValueMember = MyDataSet.Tables(0).Columns(0).ColumnName
> 
>    DataGrid1.DataSource = MyDataSet.Tables(0)
>    DataGrid1.DataMember = "NameOfRelationBetweenTables"
> End Sub
> 
> This way the DataGrid should be auto filtered when you change ComboBox 
> selection.
> 
> 
> HTH,
> Greetings
> 
> 
> 
> > Note. My code is based on "Using a Data Set with Tables in a Parent-Child
> > Relationship" from Chapter 10 (pg. 402-408) of "Programming Microsoft SQL
> > Server 2000 with Microsoft Visual Basic .NET" by Rick Dobson.
> >
> > Richard
> 
> 
> 
> 
> 
> 

2.Output SqlParameter Returns NULL Value When Procedure Assigns a Va

I am encountering the following problem with a call to a stored procedure 
from C# code.

The stored procedure looks like this:

ALTER  PROCEDURE sproc
@id1 int,
@id2 int,
@trans_date datetime,
@flag1 bit output,
@result int Output
AS
.
.
.
Set @flag1 = (SELECT flag From MyTable
Where id = @id2)
-- A record is found and debugger shows @flag1 has a value
.
.
.
Return 0

The C# code:
sqlCmdData.CommandText = "sproc";
sqlCmdData.Parameters.Clear();
sqlCmdData.Parameters.AddWithValue("@id1", _id1);
sqlCmdData.Parameters.AddWithValue("@id2", _id2);
sqlCmdData.Parameters.AddWithValue("@trans_date", DateTime.Now);
SqlParameter sqlParmFlag = new SqlParameter("@flag1",   SqlDbType.Bit);
sqlParmFlag.Direction = ParameterDirection.Output;
sqlCmdData.Parameters.Add(sqlParmFlag);
SqlParameter sqlParmResult = new SqlParameter("@result", SqlDbType.Int);
sqlParmResult.Direction = ParameterDirection.Output;
sqlCmdData.Parameters.Add(sqlParmResult);
SqlDataReader dr = sqlCmdData.ExecuteReader();
int _status = Convert.ToInt32(sqlParmResult.Value);  // This works OK
bool flag = (bool)sqlParmFlag.Value;  // sqlParmFlag.Value is always NULL

This throws a NULL exception.

Any ideas on what may be happening here?

I would appreciate any help.

Thanks,
Eagle



3.OracleCommadbuilder: Exception: Parameter 'p1': No size set for va

Hello,

I am re-raising this post as we have a developer here running into the same issue. Is this a bug or a feature? Are there any similar bugs or features of other datatypes that we should be aware of?

Thanks!

"Peter Meinl" wrote:

> When updating an Oracle Varchar2 column with an empty string "" using the
> OracleCommandBuilder generated UpdateCommand the follwing error is thrown:
> "Parameter 'p1': No size set for variable length data type: String."
> 
> Is this a bug in the OracleCommandBuilder? Is there an elegant workaround?
> 
> Updating with DBNull.Value instead of an empty string does not throw the
> above error.
> 
> 
> 

4.when deleting a row from a datagrid how do i get the cell ( 0 ) va

5.Jr/Mid Level .Net Developer(s) Needed In Stafford, VA

6. Need help: Call server side Stored Procedure and get the return va

7. How to validate one control based on the truth value of another va

8. Server-side events do not fire the first time after client-side va



Return to dotnet framework

 

Who is online

Users browsing this forum: No registered users and 78 guest