What things should I consider when I get an intermittent exception in Visual Basic .net (debugging in Visual Studio Express 2010)? - vb.net

I'm testing my Visual Basic .net application by running it in Visual Studio express.
Sometimes it runs OK, but other times I get an exception (details below, if useful). I'm not sure why I get the exception as the particular part of the application that I am testing re-uses code that works OK for other features.
What should I check, what would give me a hint as to the root cause.
Things I tried so far are:
Rewriting some of the code to be more robust. The outcome of this was that this approach was getting out of control - I was correcting everything. I made changes such asing alternative libraries (e.g. replacing CInt with convertTo etc). Some lazy declarations, but it occurred to me that there was no problem with these with the code before my changes. And every change I seemed to solve uncovered yet another problem, another different exception
So I thought something must be fundamentally wrong with my installation, and a search found discussion group posts from people experiencing something similar. The suggested remedy would be to re-install the .net framework. So I did that and the problems still occured.
Any thoughts on approach to get to the root of the problem? I'm not asking for a solution but some fresh ideas would be very welcome.
Update:
I've added in the following code to get more detail (+1 thanks #Meta-Knight)
Dim exceptionMessage As String = ex.Message
Console.WriteLine("Message: \n" & exceptionMessage)
Dim exceptionTargetSite As String = ex.TargetSite.ToString
Console.WriteLine("Inner: \n" & ex.TargetSite.ToString)
Dim exceptionSource As String = ex.Source
Console.WriteLine("Source\n:" & exceptionSource)
' put the stack trace into a variable
' (this helps debugging - put a break point after this is assigned
' to see the contents)
Dim stackTrace As String = ex.StackTrace.ToString()
Console.WriteLine("Stack trace\n:" & stackTrace)
More details about exception
Error - Exception Message
"Arithmetic operation resulted in an overflow."
Exception Target Site:
"Int32 ToInteger(System.String)"
Exception Source:
"Microsoft.VisualBasic"
at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value) at MyCo_3rd-Party-Industrial-Printing-System.Customer_EanUpc_serialNumberGeneratorAssembly.btnPrint_Click(Object sender, EventArgs e) in C:\labelprint\MyCo 3rd-Party-Industrial-Printing-System v2\MyCo 3rd-Party-Industrial-Printing-System\PrintForms\Customer_EanUpc_serialNumberGeneratorAssembly.vb:line 271 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.PerformClick() at System.Windows.Forms.Form.ProcessDialogKey(Keys keyData) at System.Windows.Forms.Control.ProcessDialogKey(Keys keyData) at System.Windows.Forms.Control.PreProcessMessage(Message& msg) at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg) at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg) at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FPreTranslateMessage(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.RunDialog(Form form) at System.Windows.Forms.Form.ShowDialog(IWin32Window owner) at System.Windows.Forms.Form.ShowDialog() at MyCo_3rd-Party-Industrial-Printing-System.utlForm.openNewModalForm(String form) in C:\labelprint\MyCo 3rd-Party-Industrial-Printing-System v2\MyCo 3rd-Party-Industrial-Printing-System\Utilities\utlForm.vb:line 128
Update 2:
The code around line 272 was:
For i As Integer = 1 To CInt(numQuantity)
If generationMethods() Then
The code around line 272 is now (I've adjusted it):
Dim numQuantityAsStr As String = numQuantity.Text
Dim numQuantityAsInt As Integer = Convert.ToInt32(numQuantityAsStr)
For i As Integer = 1 To numQuantityAsInt
If generationMethods() Then
numQuantity is a String variable for a field in the Windows form I am using and this has a value put in it by the user, the field is used to specify the quantity of something so this variable is converted to a integer so that it can be used in a for loop. The test value I am using is always entering 1 in this field, and sometimes this causes the exception.
My alteration uses what I think is a more modern type conversion Convert.ToInt32 rather than CInt I've also introduced intermediate steps to help debug.
The exception now does not occur here but I did try this the other week and another separate exception popped up (if I remember) from somewhere else so we'll see if this fixes it. Any thoughts as to why using a different conversion utility would solve the problem?
Update 3:
An Exception now occurs elsewhere:
(But why?! This one is thrown from library code!)
The following code caused it:
Dim dateNowAsStr As String = DateTime.Now.Date.ToString
Exception Message:
"Value to add was out of range. Parameter name: value"
Exception target site:
"System.DateTime Add(Double, Int32)"
Exception source:
"mscorlib"
" at System.DateTime.Add(Double value, Int32 scale) at System.TimeZoneInfo.TransitionTimeToDateTime(Int32 year, TransitionTime transitionTime) at System.TimeZoneInfo.GetDaylightTime(Int32 year, AdjustmentRule rule) at System.TimeZoneInfo.GetIsDaylightSavingsFromUtc(DateTime time, Int32 Year, TimeSpan utc, AdjustmentRule rule, Boolean& isAmbiguousLocalDst) at System.TimeZoneInfo.GetDateTimeNowUtcOffsetFromUtc(DateTime time, Boolean& isAmbiguousLocalDst) at System.DateTime.get_Now() at GenerationLibrary.GenerationUtilities.callserialNumberGenerator(String serialNumberGeneratorSnFile, String serialNumberGeneratorRange, DefaultSettingsHandler settings) in C:\labelprint\MyCo 3rd-Party-Industrial-Printing-System v2\GenerationLibrary\GenerationUtilities.vb:line 28 at GenerationLibrary.MyCoSnGeneration.constructMyCoSn(DataRow& oDataRow, DefaultSettingsHandler& settings) in C:\labelprint\MyCo 3rd-Party-Industrial-Printing-System v2\GenerationLibrary\MyCoSnGeneration.vb:line 18 at MyCo_3rd-Party-Industrial-Printing-System.Customer_EanUpc_serialNumberGeneratorAssembly.generationMethods() in C:\labelprint\MyCo 3rd-Party-Industrial-Printing-System v2\MyCo 3rd-Party-Industrial-Printing-System\PrintForms\Customer_EanUpc_serialNumberGeneratorAssembly.vb:line 40 at MyCo_3rd-Party-Industrial-Printing-System.Customer_EanUpc_serialNumberGeneratorAssembly.btnPrint_Click(Object sender, EventArgs e) in C:\labelprint\MyCo 3rd-Party-Industrial-Printing-System v2\MyCo 3rd-Party-Industrial-Printing-System\PrintForms\Customer_EanUpc_serialNumberGeneratorAssembly.vb:line 275 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.PerformClick() at System.Windows.Forms.Form.ProcessDialogKey(Keys keyData) at System.Windows.Forms.Control.ProcessDialogKey(Keys keyData) at System.Windows.Forms.Control.PreProcessMessage(Message& msg) at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg) at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg) at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FPreTranslateMessage(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.RunDialog(Form form) at System.Windows.Forms.Form.ShowDialog(IWin32Window owner) at System.Windows.Forms.Form.ShowDialog() at MyCo_3rd-Party-Industrial-Printing-System.utlForm.openNewModalForm(String form) in C:\labelprint\MyCo 3rd-Party-Industrial-Printing-System v2\MyCo 3rd-Party-Industrial-Printing-System\Utilities\utlForm.vb:line 128"
Update 4
BUT
Dim dateNowAsStr As String = CStr(DateTime.Now)
does not cause the exception

Before rewriting or reinstalling anything, you should try to identify the source and the reason for the error.
The first thing to do is to analyse the error message and stack trace. If you include debugging files (.pdb) with your application's files, you will get more detailed information such as the line number which can be helpful.
If that doesn't give enough information about the circumstances of the error, then you can add some logging to your app. By logging what the user does in your app it might help reproduce the problem.
Finally you can always get help by searching on google or asking on StackOverflow, but make sure to include the actual error message, not just the stack trace... You should also post the code where the error happens.
Edit:
So the actual error is: "Arithmetic operation resulted in an overflow."
Googling this would have helped: you would have found out that such an error happens when you're trying to convert a number which is out of bounds for an integer. If you expect to have some very large numbers you can try converting to Long instead.

I think you can start by looking at what is at line 271 of the Customer_EanUpc_serialNumberGeneratorAssembly.vb source code file.
Which is located: C:\labelprint\MyCo 3rd-Party-Industrial-Printing-System v2\MyCo 3rd-Party-Industrial-Printing-System\PrintForms\ directory.
It looks like the problem is related to a conversion between string to integer where maybe it failed because the string cannot be converted to integer... maybe it has alphanumeric characters...
"Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)"
Did you already check that?
Why you get the error some times and not always could be because (and I'm guessing here) the code in serialNumberGeneratorAssembly sometimes generates numeric only values (that can be correctly converted to integer) and some other times generates alphanumeric serial numbers (that throw the convertion exception).
UPDATE: the code that generates the Serial Numbers is generating numbers bigger than an Integer value. Try converting to Long instead of Integer... or have a look at System.Numerics.BigInteger in case those numbers are too big.
That explains the: "Arithmetic operation resulted in an overflow." exception message.

Related

Windows 10 SDK 1.3 visual designer hangs and throws error

I updated VS 2015 to Update 2 along with the 1.3 SDK, now when I open a xaml file the designer seems to be working hard and hanging all of VS. When closing shows there was an exception, checking the log it shows this:
Any workaround yet?
<entry>
<record>919</record>
<time>2016/04/05 16:54:19.061</time>
<type>Error</type>
<source>Editor or Editor Extension</source>
<description>System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.VisualStudio.DesignTools.DesignerHost.HostServices.HostProject.get_CodeDocumentTypeIdentifier()
at Microsoft.VisualStudio.DesignTools.HostUtility.Extensions.HostExtensions.IsCPlusPlusProject(IHostProject project)
at Microsoft.VisualStudio.DesignTools.Xaml.LanguageService.Metadata.ManagedTypeResolverService.GetTypeResolver(IHostProject hostProject)
at Microsoft.VisualStudio.DesignTools.Xaml.LanguageService.XamlFileInformationService.CreateFileInformationContext(IHostSourceItem sourceItem)
at Microsoft.VisualStudio.DesignTools.Xaml.LanguageService.XamlLanguageService.GetFileContextScope(String fileName, IVsTextLines textLines, IXamlFileInformationContext& fileContext)
at Microsoft.VisualStudio.DesignTools.Xaml.LanguageService.XamlLanguageService.EnsureBufferCache(IVsTextLines textLines)
at Microsoft.VisualStudio.DesignTools.Xaml.LanguageService.XamlLanguageService.EnsureBufferCache(IVsTextView view)
at Microsoft.VisualStudio.DesignTools.Xaml.LanguageService.XamlSource.BeginParse(Int32 line, Int32 idx, TokenInfo info, ParseReason reason, IVsTextView view, ParseResultHandler callback)
at Microsoft.VisualStudio.Package.ViewFilter.GetDataTipText(TextSpan[] aspan, String& textValue)
at Microsoft.VisualStudio.Editor.Implementation.ShimQuickInfoSource.TryGetQuickInfoFromFilter(IQuickInfoSession session, TextSpan[] dataBufferTextSpan, String& tipText)
at Microsoft.VisualStudio.Editor.Implementation.ShimQuickInfoSource.AugmentQuickInfoSession(IQuickInfoSession session, IList`1 qiContent, ITrackingSpan& applicableToSpan)
at Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoSession.Recalculate()
at Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoSession.Start()
at Microsoft.VisualStudio.Language.Intellisense.Implementation.DefaultQuickInfoController.OnTextView_MouseHover(Object sender, MouseHoverEventArgs e)
at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.RaiseHoverEvents()</description>
This one shows too:
<entry>
<record>917</record>
<time>2016/04/05 16:52:01.816</time>
<type>Error</type>
<source>XAML Designer</source>
<description>XAML Designer Exception
Type: System.ArgumentNullException
Message: Value cannot be null.
Parameter name: source
Stack:
at System.Linq.Enumerable.SelectMany[TSource,TResult](IEnumerable`1 source, Func`2 selector)
at Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.WindowsXamlManifestUtility.GenerateExtensionsXml(IHostProject project, ManifestSchema schema)
at Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.WindowsXamlManifestUtility.<>c__DisplayClass33_0.<GenerateManifestContents>b__0()
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass48_0`1.<MarshalIn>b__0()
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.Call.Invoke(Boolean waitingInExternalCall)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.InvokeCall(Call call)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.DirectInvoke(Boolean inbound, Action action, Int32 sourceApartmentId, Int32 targetApartmentId, Int32 originId, WaitHandle aborted)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.DirectInvokeInbound(Action action, Int32 targetApartmentId)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalIn(Action action, Int32 targetApartmentId, CancellationToken cancelToken, CallSynchronizationMode syncMode, CallModality callModality, String methodName, String filePath, Int32 lineNumber)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalIn(IRemoteObject targetObject, Action action, CallSynchronizationMode syncMode, CallModality callModality, ApartmentState apartmentState, String memberName, String filePath, Int32 lineNumber)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalIn[TResult](IRemoteObject targetObject, Func`1 func, CallModality callModality, ApartmentState apartmentState, String memberName, String filePath, Int32 lineNumber)
at Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.WindowsXamlManifestUtility.GenerateManifestContents(IEnumerable`1 dependencyIdentifiers, IHostProject project, String& packageId)
at Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.WindowsXamlAppPackage.CreateManifestFile()
at Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.AppPackage.InitializeApplication()
at Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.WindowsXamlAppPackage.CreateOrRecover(IHostProject project, IHostProjectService projectService, IHostPlatformService platformService, IHostShadowCopyService shadowCopyService, PackageService packageService, IHostFileChangeWatcherService fileChangeWatcherService, String frameworkPackagePath)
at Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.PackageService.<>c__DisplayClass10_0.<.ctor>b__0(IHostProject project, IHostProjectService projectService, IHostPlatformService platformService, IHostShadowCopyService shadowCopyService)
at Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.PackageService.CreateAppPackage(IHostProject hostProject)
at Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.PackageService.GetOrCreateAppPackage(IHostProject project, Boolean& isCreated)
at Microsoft.VisualStudio.DesignTools.DesignerHost.HostServices.HostProject.get_AppPackage()
at Microsoft.VisualStudio.DesignTools.Designer.DesignerService.InitializePrimaryProject(IHostProject project)
at Microsoft.VisualStudio.DesignTools.Designer.DesignerService.InitializeLanguageContextComponents(IHostProject project)
at Microsoft.VisualStudio.DesignTools.Designer.DesignerService.CreateDesigner(IHostSourceItem item, IHostTextEditor editor, CancellationToken cancelToken)
at Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerViewInfo(CancellationToken cancelToken)
</description>
When I create a new project the designer works fine but I get the following error on project properties on Application tab:
Property accessor 'TargetDescriptions' on object 'Microsoft.VisualStudio.ProjectFlavoring.Automation.Project.CommonProjectExtender' threw the following exception:'Value cannot be null.
This happens either if I keep min version 10.0.10240 or leave min as 10586
Removing SDK 10240 worked to solve the designer issue in my "old" project, still the error at the project properties happens
UPDATE:
I completely uninstalled the Windows 10 SDK, along with the 8.1 SDK, then reinstalled only 10 SDK (10586) using the VS installer from the dev site https://developer.microsoft.com/en-us/windows/downloads
And it's worse now, I can't compile, the application tab in properties now says this:
An error occurred trying to load the page.
InvalidArgument=Value of '0' is not valid for 'SelectedIndex'.
Parameter name: SelectedIndex
Also when I try to create a new Blank Universal app I get the following message:
"Could not find a suitable SDK to target"
Well, the only thing that worked was uninstalling all standalone Windows SDKs, from 10586.11, 10586.15 and before, then reinstalling the 10586.15 again, this worked finally, just in case someone gets into this

LongListSelector strange behavior

My purpose is to add two buttons which allow the user to jump to the first of to the last item quickly. I'm using MVVM path and the code is very simple:
Sub ScrollDown()
If ResponseModel.Items.Count > 0 And ResponseModel.IsDataLoaded Then
If ResponseModel.Items.LastOrDefault IsNot Nothing Then ResponseList.ScrollTo(ResponseModel.Items.LastOrDefault())
End If
End Sub
Sometimes this code throws a NullReferenceException on the last line, yes, the one with End Sub. None of these object are null, so I can't find out what the problem is.
System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Phone.Controls.LongListSelector.ScrollTo(Object item, Nullable`1 isGroup) at Microsoft.Phone.Controls.LongListSelector.ScrollTo(Object item) at WindowsPhoneAnswers.Thread.Lambda$_68() at WindowsPhoneAnswers.Thread.Lambda$_67(Object a0, EventArgs a1) at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args) at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
The only possible explanation is that the last item hasn't been realized yet, but how to check it?
The solution sounds weird as well. It seems that calling the method using the Dispatcher solves the issue.
However this is odd since the exception was raised randomly and I'm not on a background thread.

What is WndProc message 24

I am currently trying to make an existing VB.NET Project run. A null pointer exception is thrown in the WndProc message but the stack trace does not really give me anything. I can place a break point in the startup form's designer code but when I step through it triggers a NULL pointer exception via WndProc function. The upper methods seems to be Windows methods. The only clue I have is the Message parameter with Msg = 24 and WParam = 1. I think the HWnd = 5178884 does not help.
I am pasting the stack trace in case someone has any ideas.
Note: I masked the MyNamespace and MyBaseForm and MyFormA because the source code is proprietary. This runs in Visual Studio 2008 on .NET Framework 3.5
MyNamespace.Forms.MyBaseForm.WndProc(Message& m)\r\n
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\r\n
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\r\n
System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n
System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)\r\n
System.Windows.Forms.Control.SetVisibleCore(Boolean value)\r\n
System.Windows.Forms.Form.SetVisibleCore(Boolean value)\r\n
System.Windows.Forms.Control.set_Visible(Boolean value)\r\n
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n
System.Windows.Forms.Application.Run(ApplicationContext context)\r\n
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()\r\n
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()\r\n
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)\r\n
MyFormA.My.MyApplication.Main(String[] Args)
17d14f5c-a337-4978-8281-53493378c1071.vb:Line 81\r\n
System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n
System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n
System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n
System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n
System.Threading.ThreadHelper.ThreadStart()"
WM_SHOWWINDOW = 24
...not that it really helps.
It looks like the last bit of your code to be executed is line 81, I'd study that.
I just want to give another answer on how to know where the error came from even if the stack trace did not tell you anything (The actual problem why I asked what is WndProc 24). Just in case other people had the same problem too.
I used the Unhandled Exception via Debug > Exceptions menu on Visual Studio. See this link for detail.
Maintaining the point to C.Barlow as he answered the initial question.

Updating/Inserting is not supported by data source

I've been making my first ASP.NET Visual Studio website and I have just started working with databases, I've made a table and a backoffice page for me to control the content of my table.
This page follows the following rules:
-> I've added the SQLDataSource and configured.
-> I've added a gridview to see my content and configured it to my SQLDataSource, here I've added the Edit/Delete options.
-> I've added a DetailsView configured to my SWLDataSource, here I've added New option (to create new entries in my table)
My database has the id column set as primary key (data type=int; allow nulls=not checked)
Every time I try to update my data base through this backoffice page I get the following error:
Updating is not supported by data
source 'SqlDataSource1' unless
UpdateCommand is specified.
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.NotSupportedException: Updating
is not supported by data source
'SqlDataSource1' unless UpdateCommand
is specified.
Source Error:
An unhandled exception was generated
during the execution of the current
web request. Information regarding the
origin and location of the exception
can be identified using the exception
stack trace below.
Stack Trace:
[NotSupportedException: Updating is
not supported by data source
'SqlDataSource1' unless UpdateCommand
is specified.]
System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary
keys, IDictionary values, IDictionary
oldValues) +1644420
System.Web.UI.DataSourceView.Update(IDictionary
keys, IDictionary values, IDictionary
oldValues,
DataSourceViewOperationCallback
callback) +92
System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow
row, Int32 rowIndex, Boolean
causesValidation) +907
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs
e, Boolean causesValidation, String
validationGroup) +704
System.Web.UI.WebControls.GridView.OnBubbleEvent(Object
source, EventArgs e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object
source, EventArgs args) +37
System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object
source, EventArgs e) +123
System.Web.UI.Control.RaiseBubbleEvent(Object
source, EventArgs args) +37
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs
e) +118
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String
eventArgument) +135
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
+13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
postData) +175
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint) +1565
I could really use some help here!
The errormessage says it all : 'Updating is not supported by data source 'SqlDataSource1' unless UpdateCommand is specified.'. You have to assign sql code or the name of a stored procedure to the property UpdateCommand so that the SqlDataSource knows how to handle your update.

VSTO 4.0 Excel 2007 Add-in causing Memory leaks on Windows 7

We have a VSTO 4.0 Add-in for Excel 2007 that seems to have issues with Memory leaks, but only certain documents and only on Windows 7. The behavior is similar to the LCID proxy issue that was supposedly remedied in VSTO 4. The memory spikes at about 1.2 to 1.5 GB then throws an OutOfMemory Exception. This only seems to happen when I try to open certain documents when runing on Windows 7. If I open the same documents in XP, the memory certain goes high but I do not get an exception. Basically, I get various exceptions and never in the same place twice:
----- Source: System.Windows.Forms -----
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Windows.Forms.Screen.FromRectangle(Rectangle rect)
at System.Windows.Forms.Screen.GetWorkingArea(Rectangle rect)
at System.Windows.Forms.WindowsFormsUtils.ConstrainToScreenWorkingAreaBounds(Rectangle bounds)
at System.Windows.Forms.ToolStripDropDown.GetDropDownBounds(Rectangle suggestedBounds)
at System.Windows.Forms.ToolStripDropDown.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
at System.Windows.Forms.Control.SetBounds(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
at System.Windows.Forms.Control.set_Size(Size value)
at System.Windows.Forms.ToolStripDropDown.AdjustSize()
at System.Windows.Forms.ToolStripDropDown.OnLayout(LayoutEventArgs e)
at System.Windows.Forms.ToolStripDropDownMenu.OnLayout(LayoutEventArgs e)
at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement, String affectedProperty)
at System.Windows.Forms.Layout.LayoutTransaction.DoLayout(IArrangedElement elementToLayout, IArrangedElement elementCausingLayout, String property)
at System.Windows.Forms.ToolStripItem.InvalidateItemLayout(String affectedProperty, Boolean invalidatePainting)
at System.Windows.Forms.ToolStripItem.InvalidateItemLayout(String affectedProperty)
at System.Windows.Forms.ToolStripItem.OnRightToLeftChanged(EventArgs e)
at System.Windows.Forms.ToolStripDropDownItem.OnRightToLeftChanged(EventArgs e)
at System.Windows.Forms.ToolStripItem.OnOwnerChanged(EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnOwnerChanged(EventArgs e)
at System.Windows.Forms.ToolStripItem.SetOwner(ToolStrip newOwner)
at System.Windows.Forms.ToolStripItemCollection.SetOwner(ToolStripItem item)
at System.Windows.Forms.ToolStripItemCollection.Add(ToolStripItem value)
at Hcg.Stinger.Report.ShadowRangeTree.ShadowRangeNodeEventBehavior.AddDynamicLabelMenu() in C:\Serenity6.x\Source\Hcg\Stinger\Report\ShadowRangeTree\ShadowRangeNodeEventBehavior.cs:line 135
Here's another one:
----- Source: System.Windows.Forms -----
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Windows.Forms.ToolStripManager.ProcessShortcut(Message& m, Keys shortcut)
at System.Windows.Forms.ToolStripManager.ProcessCmdKey(Message& m, Keys keyData)
at System.Windows.Forms.ContainerControl.ProcessCmdKey(Message& msg, Keys keyData)
at System.Windows.Forms.Form.ProcessCmdKey(Message& msg, Keys keyData)
at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
at System.Windows.Forms.TextBoxBase.ProcessCmdKey(Message& msg, Keys keyData)
at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
When I save the documents as stand alone docs and do not open them using the VSTO Add-in, it is able to open them with minimal memory. When I use the add in to open them, that's when things spin up and crash.
Any help or pointers as to why Windows 7 has these issues would be much appreciated.
Thanks,
Erick
Actually, I figured out the the application was creating thousands of ToolStripMenuItems for context menus on TreeNodes. Once I made those shared, it took care of the memory issue.