.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Keep getting InvalidOperationException from SectionInformation.GetParentSection

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :.NET Framework

I'm trying to use SectionInformation.GetParentSection() from inside a class inherited from System.Configuration.ConfigurationSection to get access to the SectionGroup the section is contained within but I keep getting InvalidOperationException thrown.

Am I using this method correctly? There is very little documentation on this method.


View Complete Post

More Related Resource Links

System.InvalidOperationException: Invalid attempt to read when no data is present.


Invalid attempt to read when no data is present.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: Invalid attempt to read when no data is present.

Source Error: 

Line 53:             if (reader.HasRows)
Line 54:             {
Line 55:                 Response.Write(reader.GetString(0));

Here is my code:

VS 2010 Designer InvalidOperationException after using Blend 4 VSM

Working on an WPF 4 app today and noticed the VS 2010 Designer won't load after using Blend 4 Visual State Manager. Basic info that I did. 1. Had a Button.  Would display in both VS10 Designer and Blend 4. 2. In Blend 4, I right clicked Button -> Edit Template -> Create Empty. 3. Added ContentPresenter to Grid. 4. Back in Window.xaml, added Image to Button's ContentPresenter.  Still works in both VS10 and Blend 4. 5. In Blend 4, went back to Edit Template and modified some of the States.     - Disabled: Grid Opacity 50%     - MouseOver: Grid Scale X/Y to 1.1     - Pressed: Grid Angle 15. 6. Save and go back to VS10, the designer won't load.  Get the Yellow bar at top stating something like... InvalidOperationException was thrown on "button": Property does not point to a DependencyObject in path...... The button now has an X with red circle in it. Is this a know issue?  Is there a fix? It still works in Blend 4 and I can run the WPF app in both VS10 and Blend 4. Thanks in advance.

System.InvalidOperationException: Instance operation is not valid on workflow runtime thread

Am getting the exception related in the title of this article when using the StateMachineWorkflowInstance object to arbitarily set state in my workflow code; and am unsure why.  The code follows below:   500     Protected Overrides Function Execute(ByVal executionContext As System.Workflow.ComponentModel.ActivityExecutionContext) As System.Workflow.ComponentModel.ActivityExecutionStatus   501    502    506         Dim smwi As StateMachineWorkflowInstance = New StateMachineWorkflowInstance(StaticWFRuntime.LocalRuntime, Me.WorkflowInstanceId)   511    512         'set workflow-wide database connection string   513         _connectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString   518    519         Utility.LogEnabled()   520    521         Utility.FoaeaLogger.WriteEntry("Processing TracingApplication.Execute()....", EventLogEntryType.Information)   522         If StaticWFRuntime.LocalRuntime Is Nothing OrElse StaticWFRuntime.LocalRuntime.IsStarted = False Then   523             Utility.FoaeaLogger.WriteEntry("No static RuntimeService object exists!", EventLogEntryType.Warning)   524         End If   525    526         Return MyBase.Execute(executionContext)   527    528     End Function   796     Private Sub gotoState2_ExecuteCode(ByVal sender As System.Object, ByVal e As System.EventArgs)   797    798        

InvalidOperationException error with jquery call to webmethod

Hi, I'm having an issue which results in returning the following from XHR requests to an webmethod on my form. {"Message":"Authentication failed.","StackTrace":null,"ExceptionType":"System.InvalidOperationException"}Simplified form Code is as follows. [WebMethod]        public string LoadContact()        {            return string.Format("Hello From Server");        }I'm using JQuery to make the call: $.ajax({            type: "POST",            url: "SYS_AjaxResearch.aspx/LoadContact",            data: "{}",            contentType: "application/json; charset=utf-8",            dataType: "json",            success: function(msg) {                $("#topPanel").text(msg.d.LoadContact);   

System.InvalidOperationException: Timeout expired.

Hi I am getting the following error on my page:System.InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at _default.commentCount(Int32 ArtID) at ASP.default_aspx.__DataBind__control4(Object sender, EventArgs e)....I thought I had closed all the connections in my code:Imports System.Data Imports System.Data.SQLClient Partial Class _default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load commentDisplay() End Sub Sub commentDisplay() Dim pageno As Integer = Request.QueryString("page") Dim MyConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("nbb").ConnectionString) Dim MyDataAdapter As SqlDataAdapter MyDataAdapter = New SqlDataAdapter("art_getHomepage", MyConnection) MyDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure

Farm, SPWebApplication.Lookup, System.InvalidOperationException

Dear all,   I have a piece of code that works well on a standalone SharePoint installation:   public void SetPeoplePickerProperty(string webAppUrl) { // elevate permissions to allow setting of property. SPSecurity.RunWithElevatedPrivileges(delegate() { System.Uri srvrUri = new System.Uri(webAppUrl); SPWebApplication webApp = SPWebApplication.Lookup(srvrUri); if (!webApp.PeoplePickerSettings.OnlySearchWithinSiteCollection) { webApp.PeoplePickerSettings.OnlySearchWithinSiteCollection = true; webApp.Update(); } }); }   When I deploy it to a server farm, I get the following error: System.InvalidOperationException: This operation can be performed only on a computer that is joined to a server farm by users who have permissions in SQL Server to read from the configuration database. To connect this server to the server farm, use the SharePoint Products and Technologies Configuration Wizard, located on the Start menu in Administrative Tools.   at Microsoft.SharePoint.Administration.SPWebApplication.Lookup(Uri requestUri) The user running the query is farm administrator. It has the necessary access to the configuration database. The server running the code is joined to the farm.   Ideas anyone?   Thanks,   Tore.

System.InvalidOperationException: The 'IBMDA400.DataSource.1' provider is not registered on the lo

I am run the ETL package through the SQL Server Agent, the job fails with the error message "System.InvalidOperationException: The 'IBMDA400.DataSource.1' provider is not registered on the local machine.". But when i run trough the UI is runs fine. I am uisng OLE DB driver to the connect to AS400. can you please tekk ne where a im going wrong.   The  log file entery is as follows    OnProgress,DCMS2100,RBGDC01\SMTSQL_service,LMS_ORDER_HEADER REFRESH,{78FE47C8-9539-4A20-8FC7-BC790204C2F0},{AF7E99E5-653C-4BF5-B5A1-B1E7CE2AEE9E},31/07/2006 19:57:30,31/07/2006 19:57:30,0,0x,ValidatingOnProgress,DCMS2100,RBGDC01\SMTSQL_service,LMS_ORDER_HEADER REFRESH,{78FE47C8-9539-4A20-8FC7-BC790204C2F0},{AF7E99E5-653C-4BF5-B5A1-B1E7CE2AEE9E},31/07/2006 19:57:30,31/07/2006 19:57:30,50,0x,ValidatingOnError,DCMS2100,RBGDC01\SMTSQL_service,LMS_ORDER_HEADER REFRESH,{78FE47C8-9539-4A20-8FC7-BC790204C2F0},{AF7E99E5-653C-4BF5-B5A1-B1E7CE2AEE9E},31/07/2006 19:57:31,31/07/2006 19:57:31,-1073450910,0x,System.InvalidOperationException: The 'IBMDA400.DataSource.1' provider is not registered on the local machine.   at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper)   at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)   at System.Data.OleDb.OleDbConnectionFactory.Cr

Receiving error when saving site as template: [InvalidOperationException: Error generating solution

I am getting the following error when saving a site as a template (just this specific site is having this issue - other sites in collection successfully save as template): [InvalidOperationException: Error generating solution files in temporary directory.] Microsoft.SharePoint.SPSolutionExporter.ExportWebAsSolution() +26053165 Microsoft.SharePoint.SPSolutionExporter.ExportWebToGallery(SPWeb web, String solutionFileName, String title, String description, ExportMode exportMode, Boolean includeContent, String workflowTemplateName, String destinationListUrl) +1778 Microsoft.SharePoint.SPSolutionExporter.ExportWebToGallery(SPWeb web, String solutionFileName, String title, String description, ExportMode exportMode, Boolean includeContent) +44 Microsoft.SharePoint.ApplicationPages.SaveAsTemplatePage.BtnSaveAsTemplate_Click(Object sender, EventArgs e) +331 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981 I'm thinking it may have something to do with permissions, but other sites can save as a template. Also, it does not specify

InvalidOperationException using auto-generated class

I'm getting the below exception while trying to create an instance of  XmlSerializer using the class generated from XsdObjecGen. Any ideas on what may be causing this? System.InvalidOperationException: There was an error reflecting field '__ApplicationArea'. ---> System.InvalidOperationException: There was an error reflecting type 'ConsoleApplication2.Oagis.ApplicationArea'. ---> System.InvalidOperationException: There was an error reflecting field '__Sender'. ---> System.InvalidOperationException: There was an error reflecting type 'ConsoleApplication2.Oagis.Sender'. ---> System.InvalidOperationException: There was an error reflecting field '__LogicalID'. ---> System.InvalidOperationException: There was an error reflecting type 'ConsoleApplication2.Oagis.LogicalID'. ---> System.InvalidOperationException: There was an error reflecting field '__Value'. ---> System.InvalidOperationException: There was an error reflecting type 'System.String'. ---> System.InvalidOperationException: Value 'String' cannot be used for the XmlElementAttribute.DataType property. The datatype 'http://www.w3.org/2001/XMLSchema:String' is missing. The code in question from the exception.. '*********************** XmlText field *********************** <XmlText(DataType:="String"), _ EditorBrowsable(EditorBrowsableState.Advance

Word Interop - System.InvalidOperationException in System.Windows.Forms.dll



Microsoft Visual Studio 2005 Version 8.0.50727.42 

Microsoft .NET Framework Version 2.0.50727

Word 2003 Interop


I am trying to recreate the "AmbiguousMember" example from p. 31 of Whitechapel's "MS .NET Development for MS Office" using VB instead of VC#.

This involves implementing an event handler for the Word Quit event. In the event handler, I need to toggle the Enabled state of two buttons. This causes the following error:

A first chance exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll

The code behind the Form1 form is shown below. Form1 has two buttons: Button1 "Run Word"; Button2 "Quit Word". The event handler is intended to clean up if the user quits the Word application, and reset the buttons.

A net s

System.InvalidOperationException: Internal .Net Framework Data Provider error 12.



I have created an application in which there are few forms. Each form has fields which are linked to a backend table/tables. My application is supposed to be accessed by multiple users concurrently. I ran a test where I created a class file in windows application and i ran a for loop in it to call the url of my application. I wanted to test the effect of firing around 200 queries to my query engine.

The test code is :

namespace MachineGun


static class Program


/// <summary>

/// The main entry point for the application.

/// </summary>


Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method a


I have just upgraded our web applications to RC1 (please don't change the namespaces again microsoft!), and are getting the following error on one of our pages:

A Runtime Error has occurred.
Do you wish to Debug?

Line: 3088
Error: Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method.

Has anyone elst seen this error?


InvalidOperationException in SynchronizationContextSwitcher.Undo


I can't repro this on my machine, but on a customers machine my app throws the following exception:



The Undo operation encountered a context that is different from what was applied in the corresponding Set operation. The possible cause is that a context was Set on the thread and not reverted(undone).


   at System.Threading.SynchronizationContextSwitcher.Undo()

   at System.Threading.ExecutionContextSwitcher.Undo()

   at System.Threading.ExecutionContext.runFinallyCode(Object userData, Boolean exceptionThrown)

InvalidOperationException in VS2010 WPF Designer on Visual State Manager



When adding WPF styles through control templates and resourcedictionarys VS2010 throws an InvalidOperationException error in the designer on controls when certain properties are set, that link back to the Visual States. I thought this must be the way i was creating the Visual States (i am using Blend 4.0) but I am also getting the same error, even using the ControlTemplateExamples downloaded from the msdn site.  http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=wpfsamples&DownloadId=7741

I opened up the solution in VS2010, then opened MainWindow.xaml (split screen - designer and markup)


'System.Windows.Media.Animation.ColorAnimation' animation object cannot be used to animate property 'Foreground' because it is of incompatible type 'System.Windows.Media.Brush'.

... there are 11 errors but the solution builds successfully and runs fine.

If you look at the markup in MainWindow.xaml and the first set of buttons, the first error is linked to the "IsEnabled" property

ReloadTrackingProfiles: System.InvalidOperationException: TrackingListener for instance %0 is not in



I am hosting Workflows (dll based) in a web application. I created my own TrackingService and my own TrackingChannel (code below). When starting a workflow, everything works fine, all events are tracked. After re-building my solution, workflows, that were running before, do not track anything anymore (although they continue execution). Info: On every build, the build number of all assemblies is increased by default.

I tried to reload the tracking profiles after loading workflows (using workflow.ReloadTrackingProfiles();), but this leads to the error above. 

What am I doing wrong?




Here is the code for the tracking service:

    public class EnablerWFTracking : TrackingService {


        private TrackingProfile profile;


        #region Constructor

        public EnablerWFTracking()

            : base() {

            profile = this.CreateTrackingProfile();




        #region CreateTrackingProfile


ServerVersion = 'Conn.ServerVersion' threw an exception of type 'System.InvalidOperationException



I have a web service  which tries to connect to the SQL server.

It uses Integrated security = true.

I get the Conn.ServerVersion threw an exception of  type System.InvalidOperationException as soon as the connection object is instatiated.

Any leads.


InvalidOperationException within Lock


I have a collection in a singleton class, called _connectedNodes of type SynchronizedCollection<RemoteMachine.Node>. EVERY single call to access this collection is wrapped in a lock statement identical to the one in the snippet below.

lock (_instance._connectedNodes.SyncRoot)
	foreach (RemoteMachine.Node node in _instance._connectedNodes)
		if (node.Connection.State == RemoteMachine.ConnectionState.Normal)
This code is basically using async sockets to send messages to a group of connected nodes. How could I have had a 'collection was modified' error within this snippet?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend