NullReferenceException

Okay, I've encountered a strange problem and I can't find that anyone else has encountered it here. It cropped up by accident in my environment, but it's a real issue.
We were migrating our code over to our assurance server. Unfortunately, some of the keys for some of the tables didn't get moved over, so when I ran my code and it tried to do an insert into one of these tables, I get an exception because the key doesn't exist (integrity error, yada yada).
Anyway, that's not the issue. I catch the exception, clean up the command and the connection and move on... Theoretically. The next time I try to run my service, the Odpnet DLL just completely and utterly blows up. I start getting NullReferenceExceptions all over the place, and I can't even get a stack trace back to my code. It just shows me the assembly for the oracle dll. Very frustrating.
The error I'm most frequently getting is:
Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object.
at Oracle.DataAccess.Types.OpsDat.FreeValCtx(OpoDatValCtx* ctx)
at Oracle.DataAccess.Types.OpoDatCtx.Dispose()
at Oracle.DataAccess.Types.OpoDatCtx.Finalize()
But, I don't always get this. Sometimes I just get what appears to be random corruption in fields.
I've verified that it has something to do with the exception. When I fix the condition that causes the exception, my code works.
Does anyone have any clue about this? It's a potential code breaker, as I can't exactly pray that my service works correctly all the time. If exceptions blow things up (even when you catch them and think you're cleaning things up) then what can you possibly do? (Yes, I've been banging my head against the wall for a while on this one)
Any help is greatly appreciated.

Hi again,
I isolated the problem and think I found a solution from my point of view, but I thought it might be something you'd want to look into anyway.
The problem seems to occur when I do an arraybind on a parameter specified as an OracleDbType.Date. I was essentially binding an object array of MS's DateTime type to the parameter. That works until an exception is hit, then bad things happen. A couple of things seem to work to correct this. First, binding an array declared as DateTime types (rather than object), or binding an object array of OracleDate types.
Here's some really simplistic code that demonstrates the 3 different test cases. (Sorry about the formatting, I don't really have the time to convert this into a nice pretty HTML format)
using System;
using System.Data;
using System.Collections;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
namespace TestOraExceptions
/// <summary>
/// Summary description for Class1.
/// </summary>
class Test
string m_sConnString = "Data Source=GTDDEV1; User ID=****; Password=****;Min Pool Size=10;Max Pool Size=25;Connection Lifetime=340;Connection Timeout=60";
static string m_sUsage = "Specify a test to run: \n " +
"\t1 - Use array of objects of type DateTime (Causes bad things to happen)\n" +
"\t2 - Use an array declared of type DateTime (Seems to work)\n" +
"\t3 - Use array of objects of type OracleDate (Seems to work)\n";
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
if (args.Length == 0)
Console.WriteLine(m_sUsage);
return;
int iTestNum = Int32.Parse(args[0]);
if(iTestNum <= 0 || iTestNum >3)
Console.WriteLine(m_sUsage);
Test test = new Test();
switch(iTestNum)
case 1:
Console.WriteLine("Test 1");
test.runTest1();
break;
case 2:
Console.WriteLine("Test 2");
test.runTest2();
break;
case 3:
Console.WriteLine("Test 3");
test.runTest3();
break;
default:
break;
public void runTest1()
for(int i=0; i<15; i++)
generateOraException1();
public void runTest2()
for(int i=0; i<100; i++)
generateOraException2();
public void runTest3()
for(int i=0; i<100; i++)
generateOraException3();
public OracleConnection getConnection()
OracleConnection conn = null;
try
conn = new OracleConnection(m_sConnString);
conn.Open();
catch(OracleException e)
Console.WriteLine(e.Message);
return conn;
public void generateOraException1()
OracleConnection conn = getConnection();
object[] dateArray = new object[5];
for(int i=0; i<5;i++)
dateArray[i] = new DateTime(2003, 6, 2);
//Non-existant stored procedure!!! Guaranteed to generate an exception
String sStoredProcedure =
"app_mt.pk_portfolio_chars_calc2.blah_blah_blah_blah";
OracleCommand command = new OracleCommand(sStoredProcedure, conn);
command.CommandType = CommandType.StoredProcedure;
command.ArrayBindCount = dateArray.Length;
OracleParameter aDate = new OracleParameter("a_date", OracleDbType.Date);
aDate.Direction = ParameterDirection.Input;
aDate.Value = dateArray;
command.Parameters.Add(aDate);
OracleTransaction tx=null;
try
tx = conn.BeginTransaction();
command.ExecuteNonQuery();
tx.Commit();
catch (Exception e)
Console.WriteLine("Exception!");
//Console.WriteLine(e);
finally
tx.Rollback();
if (command !=null) command.Dispose();
if (conn !=null) conn.Close();
public void generateOraException2()
OracleConnection conn = getConnection();
DateTime[] dateArray = new DateTime[5];
for(int i=0; i<5;i++)
dateArray[i] = new DateTime(2003, 6, 2);
//Non-existant stored procedure!!!
String sStoredProcedure =
"app_mt.pk_portfolio_chars_calc2.blah_blah_blah_blah";
OracleCommand command = new OracleCommand(sStoredProcedure, conn);
command.CommandType = CommandType.StoredProcedure;
command.ArrayBindCount = dateArray.Length;
OracleParameter aDate = new OracleParameter("a_date", OracleDbType.Date);
aDate.Direction = ParameterDirection.Input;
aDate.Value = dateArray;
command.Parameters.Add(aDate);
OracleTransaction tx=null;
try
tx = conn.BeginTransaction();
command.ExecuteNonQuery();
tx.Commit();
catch (Exception e)
Console.WriteLine("Exception!");
//Console.WriteLine(e);
finally
tx.Rollback();
if (command !=null) command.Dispose();
if (conn !=null) conn.Close();
public void generateOraException3()
OracleConnection conn = getConnection();
object[] dateArray = new object[5];
for(int i=0; i<5;i++)
dateArray[i] = new OracleDate(2003, 6, 2);
//Non-existant stored procedure!!!
String sStoredProcedure =
"app_mt.pk_portfolio_chars_calc2.blah_blah_blah_blah";
OracleCommand command = new OracleCommand(sStoredProcedure, conn);
command.CommandType = CommandType.StoredProcedure;
command.ArrayBindCount = dateArray.Length;
OracleParameter aDate = new OracleParameter("a_date", OracleDbType.Date);
aDate.Direction = ParameterDirection.Input;
aDate.Value = dateArray;
command.Parameters.Add(aDate);
OracleTransaction tx=null;
try
tx = conn.BeginTransaction();
command.ExecuteNonQuery();
tx.Commit();
catch (Exception e)
Console.WriteLine("Exception!");
//Console.WriteLine(e);
finally
tx.Rollback();
if (command !=null) command.Dispose();
if (conn !=null) conn.Close();

Similar Messages

  • Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. --- System.NullReferenceException: Object reference not set to an instance of an object

    Hi,
    (1) I am trying to get the data from a database table and import into a text file.
    (2) If the record set have the data then it runs ok
    (3) when the record set not having any data it is giving the below error
    Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
    Could you please let me know why this is happening?
    Any help would be appriciated
    Thanks,
    SIV

    You might ask them over here.
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vbgeneral%2Ccsharpgeneral%2Cvcgeneral&filter=alltypes&sort=lastpostdesc
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • CrystalReportViewer throws NullReferenceException on parameter set

    Hi experts,
    I really hope somebody can help. I am running out of ideas.
    I inherited a web site project with some CrystalReports in it and I should install it on two new customer servers.
    When trying to run the report I got the NullReferenceException below:
    "NullReferenceException: Object reference not set to an instance of an object."
       CrystalDecisions.Web.CrystalReportViewerBase.set_ReuseParameterValuesOnRefresh(Boolean value) +31
       ASP.Page_aspx.__BuildControlCrystalReport()
       ASP.Page_aspx.__BuildControlshow_filter()
    At the line:
    <CR:CrystalReportViewer ID="CrystalReportVPI" runat="server" AutoDataBind="True" EnableDatabaseLogonPrompt="False" EnableParameterPrompt="False" ReuseParameterValuesOnRefresh="True" ... />
    I tried to set the parameters programmatically:
        protected void Page_PreInit(object sender, EventArgs e)
            CrystalReportVPI.AutoDataBind = true;
            CrystalReportVPI.EnableDatabaseLogonPrompt = false;
            CrystalReportVPI.EnableParameterPrompt = false;
            CrystalReportVPI.ReuseParameterValuesOnRefresh = true;
             u2026
    Here i noticed that tha the NullReferenceException is thrown only in the line:
    CrystalReportVPI.ReuseParameterValuesOnRefresh = true;
    The same site runs on developer environment and on another customeru2019s server with no errors.
    The server environment is:
    u2022     Win Server 2003
    u2022     CRRedist2005_x86.msi
    u2022     .NET version 2.
    I think there is an installation issue.
    Any help would be highly appreciated.

    Hi,
    I retried by removing all CR 2008 attributes.
    This time the NullReferenceException was thrown there:
    [NullReferenceException: Object reference not set to an instance of an object.]
       CrystalDecisions.Web.CrystalReportViewer.OnPreRender(EventArgs e) +1025
       System.Web.UI.Control.PreRenderRecursiveInternal() +80
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint
    Thanks!

  • SQL CLR Table-Valued Function System.NullReferenceException

    Good day.
    I wrote a clr table-valued function that gets the data from the sharepoint list using the client model.
    Sometimes I get exception (When I calling this function I get 90000 rows and then I get this exception...):
    Msg 6260, Level 16, State 1, Line 1
    An error occurred while getting new row from user defined Table Valued Function :
    System.NullReferenceException: Object reference not set to an instance of an object. System.NullReferenceException: v at SDS.FillRow(Object obj, SqlInt32& month, SqlString& datePlanSalary, SqlString& dilerCode, SqlString& dilerName, SqlString&
    model, SqlInt32& countSalary).
    How can I fix this issue?
    My Code:
    public class SDS
    [SqlFunction(SystemDataAccess = SystemDataAccessKind.Read, FillRowMethodName = "FillRow")]
    public static IEnumerable SDSItems(SqlString url, SqlString listName)
    ClientContext context = new ClientContext(url.ToString());
    List list = context.Web.Lists.GetByTitle(listName.ToString());
    CamlQuery query = new CamlQuery();
    query.ViewXml = "<View/>";
    ListItemCollection listItems = list.GetItems(query);
    context.Load(list);
    context.Load(listItems);
    context.ExecuteQuery();
    return listItems;
    public static void FillRow(
    object obj,
    out SqlInt32 month,
    out SqlString datePlanSalary,
    out SqlString dilerCode,
    out SqlString dilerName,
    out SqlString model,
    out SqlInt32 countSalary
    item = (ListItem)obj;
    month = Convert.ToInt32(item["_x041c__x0435__x0441__x044f__x04"]);
    datePlanSalary = Convert.ToString(item["_x0414__x0430__x0442__x0430__x000"]);
    dilerCode = Convert.ToString(item["_x041a__x043e__x0434__x0020__x04"]);
    dilerName = Convert.ToString(item["_x041d__x0430__x0437__x0432__x04"]);
    model = ((FieldLookupValue)item["_x041c__x043e__x0434__x0435__x04"]).LookupValue;
    countSalary = Convert.ToInt32(item["_x041a__x043e__x043b__x0438__x04"]);

    That's not a lot of information to go on, but...
    Can you put a check in your FillRow method for a null object (or one of your fields being null) and put out diagnostic information? Or is it happening in the ListItemCollection iterator itself? (i.e. before it returns a row back to FillRow). If it's happening
    in the iterator, perhaps you could subclass it and return diagnostics at that point.
    I'm also wondering (if it actually always happen at row 90000) if you're hitting a limit in web service call, or iterator, or UDF code. Does the function ever return more than 90000 rows successfully?
    Hope this helps, Bob

  • Why do I get a "NullReferenceException was not handled by user code" error in one situation but not in the other?

    We are using Sharepoint 2010 and Infopath 2010.  In my form, I have a Managed Metadata field that I need to test for a Null value.  I found, with the help of this forum's participatns, that a [field]_Changed event for one MMD field runs multiple
    time because of the underlying XML elements (Terms, TermInfo, TermName, TermId).  So I'm trying to figure out how to test the XML to see when the TermName has a value.  By doing this, I hope to limit when the additional code in my form runs, i.e.
    I'll only trigger it when TermName is not null. 
    Just to test for null/empty (before doing anything that calls the addtional code) when I run this code, it completes correctly but always shows a message box:
    Dim strTest As String = Me.CreateNavigator.SelectSingleNode("/pr:properties/p:properties/documentManagement/ns2:h2b59c4ae4144c01973b1d8571d217ad", Me.NamespaceManager).InnerXml
                If String.IsNullOrEmpty(strTest) Then
                Else
                    MessageBox.Show("This is the value of the States InnerXML   " & strTest)
                End If
    But when I run this code, I get a "NullReferenceException was not handled by user code.  Object reference not set to an instance of an object" at the "Dim strTest..." line:
       Dim strTest As String = Me.CreateNavigator.SelectSingleNode("/pr:properties/p:properties/documentManagement/ns2:h2b59c4ae4144c01973b1d8571d217ad/pc:Terms/pc:TermInfo/pc:TermName", Me.NamespaceManager).InnerXml
                If String.IsNullOrEmpty(strTest) Then
                Else
                    MessageBox.Show("This is the value of the States InnerXML   " & strTest)
                End If
    Can any one explain why drilling down like this gives me this error?  And can you tell me how to get around it so I can limit how many times the code in my Infopath form needs to run?
    Thanks in advance.  Carol.

    Never mind, I think I've got it figured out.  When I do it this way, I get to the If Not...Nothing at the correct time. Thanks for sending me down the correct path, Scott. Carol.:
    Dim
    firstStr As
    String =
    String.Empty         
    Dim xNav
    As XPathNavigator = MainDataSource.CreateNavigator()
    Dim xFirst
    As XPathNavigator = xNav.SelectSingleNode("/pr:properties/p:properties/documentManagement/ns2:h2b59c4ae4144c01973b1d8571d217ad/pc:Terms/pc:TermInfo/pc:TermName",
    Me.NamespaceManager)
    If
    Not xFirst
    Is
    Nothing
    Then               
    Dim strxFirst
    As
    String = xFirst.InnerXml
                    MessageBox.Show(
    "Value of InnerXML   " & strxFirst)
    Else
                    MessageBox.Show(
    "Empty or Null")           
    End
    If

  • System.NullReferenceException when Modifying Application

    Hi all,
    we're getting the enclosed error when modifying an Application.
    System information:
    SAP EHP 1 for SAP NetWeaver 7.0, Support Package 5
    Client has all .NET Frameworks (1.1, 2.0, 3.0, 3.5)
    Did anyone had that before?
    Thanks,
    Steffen
    See the end of this message for details on invoking
    just-in-time (JIT) debugging instead of this dialog box.
    Exception Text **************
    System.NullReferenceException: Object reference not set to an instance of an object.
       at OSoft.Consumers.Common.StatusDialog50.StatusDialog.ShowExternalMessage(MessageNode& msgNode)
       at OSoft.Consumers.Common.StatusDialog50.StatusDialog.lstMessage_DoubleClick(Object sender, EventArgs e)
       at System.Windows.Forms.Control.OnDoubleClick(EventArgs e)
       at System.Windows.Forms.TreeView.WndProc(Message& m)
       at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    Hi Steffen,
    Please review the following steps.
    1. Install .NET Framework version 1.1 and 2.0 on each application and web server. If required, remove the other versions of .NET.
    2. Install the required .NET 1.1 Hotfix by going to http://support.microsoft.com/kb/899511. Since your operating system is Windows 2003 Server, install both 237428_ENU_i386_zip.exe and 237718_ENU_i386_zip.exe.
    To configure the .NET server component, take the following steps:
    1. Update your IIS properties as follows:
       a) Go to Control Panel Administrative Tools Internet Information Services (IIS) Manager .
       b) Within the Osoft Virtual Directory properties, uncheck Index this resource.
       c) Update your IIS properties (Web Service Extensions) to allow ASP .NET 1.1 by finding the Web Service Extensions
           property (the path to it differs for different operating system versions), and updating it to allow ASP .NET 1.1.
    2. Verify that the IIS TCP port configurations for the Web and Server Manager components match your own IIS settings:
       a) In the ..\BPC\Websrvr\web\web.config file on the .NET server, edit the AppServer_URL parameter to indicate the port
           number assigned to IIS.
       b) In the ..\BPC\Server Management\OsoftInstall.xml file on the .NET server, edit the port<PORT>port parameter to indicate the
           port number assigned to IIS.
    Please review the steps mentioned in the installation guide. Try to restart the BPC Components
    Hope this helps.

  • Sharepoint 2010 Error: System.NullReferenceException: Object reference not set to an instance of an object when trying to upload a document

    Hi,
    Environment: Windows server 2008 R2 , Sharepoint2010
    Getting the below error while uploading a document.  Below is the stack trace.
    System.NullReferenceException: Object reference not set to an instance of an object.    
    at Microsoft.Office.RecordsManagement.PolicyFeatures.ApplicationPages.UploadPage.GetEditFormUrl(SPWeb web, SPList currentList, SPFolder currentFolder, SPContentTypeId id, String comments, SPFile spfile, String sourceUrl, HttpRequest request)     
    at Microsoft.Office.RecordsManagement.PolicyFeatures.ApplicationPages.UploadPage.GetEditFormUrl(SPFile spfile)     
    at Microsoft.Office.RecordsManagement.PolicyFeatures.ApplicationPages.UploadPage.OnSubmit(Object o, EventArgs e)     
    at Microsoft.Office.RecordsManagement.PolicyFeatures.ApplicationPages.UploadExPage.OnSubmit(Object o, EventArgs e)     
    at System.Web.UI.HtmlControls.HtmlInputButton.OnServerClick(EventArgs e)     
    at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)     
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    Still new in sharepoint, so no idea where to start.  Please advice.
    Thanks.

    Hi Alex,
    Do you have any update?
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • WPF Map Control Throws NullReferenceException

    This is a weird problem.  The exception only happens if I have a break point in my project that is hit before the project is fully loaded (before the window appears on the screen).  Not every break point causes the exception.  I have not been
    able to pinpoint what particular break points do and do not cause it.  I think it might be break points that are hit before some event happens on the UserControl that is hosting the map control but if that is the case I am not sure what event that might
    be.  If you remove the break point the application works fine.  Break points that are hit later in the application do not cause a problem.
    Here is a copy of the exception:
    System.NullReferenceException was unhandled
      HResult=-2147467261
      Message=Object reference not set to an instance of an object.
      Source=Microsoft.Maps.MapControl.WPF
      StackTrace:
           at Microsoft.Maps.MapControl.WPF.MapCore.AnimateViewUsingZoomAndPan(Double zoomLevel, Point centerNormalizedMercator)
           at Microsoft.Maps.MapControl.WPF.MapCore.SetViewInternal(Point centerNormalizedMercator, Double zoomLevel, Double heading)
           at Microsoft.Maps.MapControl.WPF.MapCore.SetView(LocationRect boundingRectangle)
           at GeoservicesControls.Views.GeofencingView.<>c__DisplayClass8.<ViewModelChangedCallback>b__0(LocationRect x) in d:\SoftwareDevelopment\AccessibleSolutions\GeoservicesControl\Source\GeoservicesControls\Views\GeofencingView.xaml.cs:line
    121
           at System.Reactive.AnonymousSafeObserver`1.OnNext(T value)
           at System.Reactive.Concurrency.ObserveOn`1.ObserveOnSink.OnNextPosted(Object value)
           at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
           at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
           at System.Windows.Threading.DispatcherOperation.InvokeImpl()
           at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Windows.Threading.DispatcherOperation.Invoke()
           at System.Windows.Threading.Dispatcher.ProcessQueue()
           at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
           at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
           at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
           at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
           at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
           at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
           at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
           at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
           at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
           at System.Windows.Application.RunInternal(Window window)
           at System.Windows.Application.Run()
           at GeoservicesControl.Shell.Wpf.App.Main() in d:\SoftwareDevelopment\AccessibleSolutions\GeoservicesControl\Source\GeoservicesControl.Shell.Wpf\obj\Debug\App.g.cs:line 50
           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException: 

    The error message indicates that the error was thrown from the GeofencingView.xaml.cs file around line 121. Can you provide the code that you have in that area and the values being used.
    http://rbrundritt.wordpress.com

  • NullReferenceException on GetSchemaTable() for query with cursor column

    Hi,
    I'm using Oracle.DataAccess.dll v 2.111.6.20 to run queries and read data using OracleDataReader directly. When I execute a query that returns cursors in one of its columns, e.g.
    select cursor(select 1 from dual) from dual
    and then call OracleDataReader.GetSchemaTable(), I get this:
    System.NullReferenceException: Object reference not set to an instance of an object.
    at Oracle.DataAccess.Client.OracleDataReader.GetOraDbType(Int32 i)
    at Oracle.DataAccess.Client.OracleDataReader.GetSchemaTable()
    at ...
    Any idea how to fix it or work around it? The app I'm working on has to handle aribitrary SQL queries, so I can't just rewrite the query to something that doesn't return cursors.
    Thanks,
    Maciek

    Did you run the query itself in the sql-plus?(select cursor(select 1 from dual) from dual)
    from this query the result is 1 in my database.How can it show the column schema of this result set?
    I guess you should send the whole code. GetSchemaTable() does not work with cursor structure.
    The GetSchemaTable method returns a DataTable property that contains the column schema for a DataReader. The DataTable contains one row for each field in the resultset. Each column maps to a property of the field in the resultset. The ColumnName property of the DataTable column is the name of the field's property, such as the ColumnName, DataType, ColumnSize, IsKeyColumn, or IsAutoIncrement property. The value of the DataTable column is the value of the field's property, such as the FirstName value for the ColumnName property.
    Edited by: sek.NET on Dec 19, 2008 2:01 PM
    Edited by: sek.NET on Dec 19, 2008 2:03 PM
    Edited by: sek.NET on Dec 19, 2008 2:16 PM

  • NullReferenceException was unhandled

    I am Building a Webbrowser in C#: this is the code
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    namespace Web_Browser
        public partial class Form1 : Form
            public Form1()
                InitializeComponent();
            private void goButton_Click(object sender, EventArgs e)
                webBrowser1.Navigate(new Uri(comboBox1.SelectedItem.ToString()));
            private void homeToolStripMenuItem_Click(object sender, EventArgs e)
                webBrowser1.GoHome();
            private void goBackToolStripMenuItem_Click(object sender, EventArgs e)
                webBrowser1.GoForward();
            private void goForwardToolStripMenuItem_Click(object sender, EventArgs e)
                webBrowser1.GoBack();
            private void Form1_Load(object sender, EventArgs e)
                comboBox1.SelectedText = "0";
                webBrowser1.GoHome();
    the problem is: when I run it I get this error
    "NullReferenceException was unhandeled"
    at the bold line
    can someone explane to me what I need to do??

    Hi programming,
    I have reproduced your code, and I was wondering what operation you made. If you debug your project and click the “goButton” after the form_load, it would appear the error message. It was becase your call the “comboBox1.SelectedItem” and “comboBox1.SelectedItem”
    was never set. I think you could modify your Form1_Load like below:
    private void Form0109_Load(object sender, EventArgs e)
    //comboBox1.SelectedText = "0";
    comboBox1.SelectedItem = comboBox1.Items[0];
    webBrowser1.GoHome();
    It would be helpful if you could share us how you get the error message.
    Best Regards,
    Edward
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

  • NullReferenceException calling SetComplete

    At the end of a distributed data transaction when we call SetComplete in our Com+ component a NullReferenceException is being thrown. Does anyone have any ideas. thanks in advance.
    The call stack is
         oracle.dataaccess.dll!Oracle.DataAccess.Client.ConnectionPool.CheckLifeTimeAndStatus(Oracle.DataAccess.Client.OpoConCtx opoConCtx, int bDistTxnEnd, bool bClosed, int bFromPool) + 0x1ad bytes     
         oracle.dataaccess.dll!Oracle.DataAccess.Client.ConnectionPool.PutConnection(Oracle.DataAccess.Client.OpoConCtx opoConCtx, bool bDoNotAllocValCtx, bool bCheckStatus, int bDistTxnEnd) + 0x32e bytes     
         oracle.dataaccess.dll!Oracle.DataAccess.Client.ConnectionPool.TransactionEnd(System.Object obj = {Oracle.DataAccess.Client.PooledConCtx}) + 0x1c7 bytes     
         system.enterpriseservices.dll!System.EnterpriseServices.ResourcePool.System.EnterpriseServices.IObjPool.PutEndTx(System.Object p = {Oracle.DataAccess.Client.PooledConCtx}) + 0x19 bytes     
         system.enterpriseservices.thunk.dll!System.EnterpriseServices.Thunk.Callback.DoCallback(System.Object otp = {System.Runtime.Remoting.Proxies.__TransparentProxy}, System.Runtime.Remoting.Messaging.IMessage msg = {System.Runtime.Remoting.Messaging.Message}, int ctx = 1278568, bool fIsAutoDone = false, System.Reflection.MemberInfo mb = {System.Reflection.RuntimeMethodInfo}, bool bHasGit = true) + 0x27a bytes     
         system.enterpriseservices.dll!System.EnterpriseServices.ServicedComponentProxy.CrossCtxInvoke(System.Runtime.Remoting.Messaging.IMessage reqMsg = {System.Runtime.Remoting.Messaging.Message}) + 0x231 bytes     
         system.enterpriseservices.dll!System.EnterpriseServices.ServicedComponentProxy.Invoke(System.Runtime.Remoting.Messaging.IMessage request = {System.Runtime.Remoting.Messaging.Message}) + 0x55 bytes     
         mscorlib.dll!System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(System.Runtime.Remoting.Proxies.MessageData msgData, int type) + 0x288 bytes     

    After doing some digging it seems that actual problem is that it can't enlist in the transaction. I've updated the oramts.dll as recommended in other posts but to no avail. Does anyone have any other ideas? Are there any security issues involved?

  • B1WS 1.1 WSDL Services Generator throwing NullReferenceException

    Hello, I'm new to B1WS so please bear with me.
    I've installed B1WS 1.1 on our test server running Windows Server 2008 Standard, SQL Server 2008 and B1 8.8. I followed the instructions in the enclosed "B1WS: B1 Web Services wrapper" document (B1WS.doc) and verified that DI Server was running.
    When I try to run the WSDL services generator against our demo company database, I get the following exception:
    System.NullReferenceException: Object reference not set to an instance of an object.
       at WebServiceDescription.SelectOperation.ShowUDOsList(String sessionID)
       at WebServiceDescription.SelectOperation..ctor(String sessionID)
       at WebServiceDescription.WsdlServicesGenerator.ShowOptions()
       at WebServiceDescription.Form1.btCreateWsdl_Click(Object sender, EventArgs e)
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    Any ideas?
    Thanks in advance.
    Update: I got a copy of the source code and found where the failure is occurring. In the SelectOperation.cs file, the generator uses the CompanyService service in order to execute the query "SELECT Code, Name FROM OUDO" against the database. The call to the Query function returns a Recordset object, but the Row collection that is part of the Recordset object is null.
    An excerpt is below:
        private void ShowUDOsList(string sessionID)
          B1WSCompanyService.CompanyService cmpSrv = new WebServiceDescription.B1WSCompanyService.CompanyService();
          B1WSCompanyService.MsgHeader msgHeader = new WebServiceDescription.B1WSCompanyService.MsgHeader();
          msgHeader.ServiceName = WebServiceDescription.B1WSCompanyService.MsgHeaderServiceName.CompanyService;
          msgHeader.ServiceNameSpecified = true;
          msgHeader.SessionID = sessionID;
          cmpSrv.MsgHeaderValue = msgHeader;
          B1WSCompanyService.RecordsetParams rsp = new B1WSCompanyService.RecordsetParams();
          rsp.Query = "SELECT Code, Name FROM OUDO";
          B1WSCompanyService.Recordset rs = cmpSrv.Query(rsp);
          bool hasWrongUDOs = false;
          string wrongUDOs = "Following UDOs are not in the list because they have spaces in their names: ";
          for (int i=0; i< rs.Row.Length; i++)   // <--- This is where the NullReferenceException is thrown.
            if (rs.Row<i>.Property[1].Value.Contains(" "))
              hasWrongUDOs = true;
              wrongUDOs += rs.Row<i>.Property[0].Value + " ";
            else
              udoCheckedListBox.Items.Add(rs.Row<i>.Property[0].Value, true);
          if (hasWrongUDOs)
            Globals.AddLog(wrongUDOs, Globals.LogType.Error);
            wrongUDOs += ". Please modify these UDOs and run one more time the WsdlServicesGenerator.exe if you want to access them through B1WS.";
            MessageBox.Show(wrongUDOs, "UDOs excluded because of spaces in their names", MessageBoxButtons.OK, MessageBoxIcon.Warning);
    Why would the Recordset object have a null Row collection?
    Edited by: Dan Jordan on Sep 15, 2010 10:25 PM

    I worked around the problem by adding a user-defined object to our demo database. I didn't have any UDO's defined there, but it looks like there's a bug in how the code handles databases without any UDO's defined.

  • System.NullReferenceException

    Hello,
    I tried to call a simple RFC-function using the .Net-Connector. The Wizard generates "SAPProxyDll1.sapwsdll" which contains the following void:
    public void Z_Vb_Test_Fg_Called_By_Vb (
            object[]results = null;
            results = this.SAPInvoke("Z_Vb_Test_Fg_Called_By_Vb",new object[] {
            return;
    When I call this void by clicking a button in my Windows-Form (whithout making any changes at the rest of the coding) the following Error appears:
    "An unhandled exception of type 'System.NullReferenceException' occurred in sap.connector.dll
    Additional information: Object reference not set to an instance of an object."
    Do I have to make any changes at the automatically generated coding, or what is the problem?
    Thanks a lot.
    Jochen

    Hello,
    thanks for your answer. The problem was that my connection didn't work properly, but now it works.
    Best regards
    Jochen

  • NullReferenceException when double clicking on form while report generating

    We have an Plugin application that allows a user to generate a Crystal report based on the selected row in a data grid.  If the report is large and takes a few moments.to load on a new tab, and the user double clicks on the grid an exception below is thrown (causing the application to close):
    System.NullReferenceException: Object reference not set to an instance of an object.
       at CrystalDecisions.Windows.Forms.PageControl.TabTo(Int32 sectionIndex, Int32 objectIndex, Boolean scroll)
       at CrystalDecisions.Windows.Forms.PageControl.OnMouseDown(MouseEventArgs e)
       at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ContainerControl.WndProc(Message& m)
       at System.Windows.Forms.UserControl.WndProc(Message& m)
       at CrystalDecisions.Windows.Forms.PageControl.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    Is there any way (or place) I can trap this error and handle it (meaning swallowing/ ignore it).  I have tried using the CrystalReportViewer (crv) Error event and various other crv events but to no avail.  I also tried disabling the grid while the report is running but the double-click still causes the exception.  Any suggestions are appreciated.
    Thanks!
    Mike

    Figured out a work-around for this.  What I did in the form that hosts the CrystalReportsViewer was disabled the CrystalReportsViewer after it's report source is set and visible is set to true.  I then enable the CrystalReportsViewer right before it's focus is set (which is set in a timer tick event).  No more exceptions!  Weird but functional!
    Mike

  • System.NullReferenceException using C#

    Hi,
    I'm trying to write a client application using C# and .Net Framework 2 with Tuxedo 11gR1 and Microsoft Visual Studio 2008. I don't have access to the server but I know the WSNADDR, services names and input/output FML buffers. I also know there is an older version of Tuxedo in the server because a I have to use "WSINTOPPRE71=yes". The question is I can get results from some services, but with others all I've got is an Exception:
    System.NullReferenceException
    at Bea.Tuxedo.ATMI.AppContext.WrapRawBuffer(TypedBufer& tb, IntPtr buff, Int64 datalen, Int64 flags)
    at Bea.Tuxedo.ATMI.AppContext.tpcall(String svc, TypedBuffer idata, TypedBuffer& odata, Int64 flags).
    I can create the application context using ac = AppContext.tpinit(tpinfo), and indicating ctlname, usrname and password in tpinfo, but ac.tpcall throws this exception. If I use tpacall, the exception is thrown with tpgetrply.
    Any idea?
    Thanks.

    Hi again.
    I've been using .NET Reflector to see where the exception is thrown. The question is tpcall calls the function
    private void WrapRawBuffer(ref TypedBuffer tb, IntPtr buff, long datalen, long flags)
    and this calls
    internal static bool GetTypedBufferInfo(IntPtr buffer, out long size, out string type, out string stype, int flags)
    I was using tpcall with no flags (TPNOFLAGS) and this was causing the execution of the next fragment of code:
    if (!(tb.Type.Equals(str) && tb.Subtype.Equals(str2)))
    When the service didn't find any record, tb.Subtype was a zero length string, but str2 was null, so this throws a NullReferenceException.
    Although I suppose this is not the best solution, I'm using now the value 257 for flags, ant it's working.
    Maybe a bug in libwscdnet.dll version 0.9.1087.4?

  • System.Nullreferenceexception Problem

    Hi,
    this is my problem, I've developed a web application with .NET 2.0.
    On my pc the oracle client is 9.2.0.1.0 .
    All works fine, on my pc, I try to run the application into another server, that connects to another DB (the DB are the same of mine) and this error appers...on a simply query the result is null
    Line 664: while (Record.Read())
    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
    Isn't a problem of data in DB, alla data are correct
    the only difference with my environment is the client... 9.2.0.1.0 on my pc.....9.0.2.0.6 on the other PC......please help!

    this is the code of OracleDataReader and an example of use it.....
    public OracleDataReader GetRecordFromOracleDb(string SQLQueryString)
    OracleDataReader Record = null;
    //string OracleConnString = ConfigurationSettings.AppSettings["OracleDbConnectionString"];
    string OracleConnString = ConnectionString;
    OracleDbConnection = new OracleConnection(OracleConnString);
    try
    OracleDbConnection.Open();
    Oracle.DataAccess.Client.OracleCommand oracleCommand = new OracleCommand(SQLQueryString, OracleDbConnection);
    try
    Record = oracleCommand.ExecuteReader();
    catch (Exception Ex)
    string Message = "Exception raised: " + Ex.Message;
    catch (Exception e)
    string Message = "Exception raised: " + e.Message;
    //OracleDbConnection.Close ();
    return Record;
    OracleDataReader Record = GetRecordFromOracleDb(SQLQueryString)
    while (Record.Read())
    In the environment where oracle client 9.2 is installed all works fine.....where ther is 9.0 it doesn't work....

Maybe you are looking for

  • Bluetooth won't connect to JBL Flip

    Is there a fix for Bluetooth yet?  My iOS7 upgrade worked for about 15 minutes and then sound jumbled and now won't work.  I removed the device and tried to pair it again with my JBL Flip. The phone sees the JBL but wont pair.  All of us in the house

  • Doubt in smartform table control

    hi,   in my smartform i want to display the table control, i got that normal table control, but i want to change the table control format, that means in write side in the tabs column no need of calculation i need event tab, how to make that? Thanks a

  • SM 58 error urgent

    hi , i am doing idoc to file . in sm 58 I getting this error"No service for system SAP<sid>, client 220 in Integr ation Directory " . i have configure r/3  & 3 rd party  systems  as bussines system . please can anyone tell me where i need mention sap

  • Info for vzw jumpers thinking of future LTE options

    Just wanted to inform folks of something I learned today from my AT&T rep. Even when VZW does release the LTE version of the iPhone, when taken out of the LTE coverage area, it will revert back to EVDO 2G. It will Not be backwards compatible with VZW

  • Schema not showing default tables

    Anyone know why a requested and granted schema would not have the default tables? Can a granted schema be deleted? Should I be asking schema questions to the administrator? Thanks in advanced for your feed back.