Questions tagged [argumentexception]

An ArgumentException is a specific exception in the .NET framework thrown when one of the arguments provided to a method is not valid.

From MSDN:

ArgumentException is thrown when a method is invoked and at least one of the passed arguments does not meet the parameter specification of the called method.

232 questions
1
vote
2 answers

How do i bind function arguments to the parameters i supply in creating an ArgumentException object?

I often have functions that take arguments like this: Public Shared Function F(ByVal address as String) So basically I want to throw new ArgumentException("Invalid address!", "address") Now problem is that when I'm using the built in refactoring…
Pacerier
  • 86,231
  • 106
  • 366
  • 634
1
vote
1 answer

Is there any shortest way to retrieve and upload image from database using c# wpf?

I have this code below that works fine. I am trying to upload and retrieve image from my database from tutorial but when I modify it with data from my database, it keeps showing Argument exception to this part System.Drawing.Image img =…
1
vote
1 answer

Save an appointment with EWS leads to System.ArgumentException: An item with the same key has already been added. Key: Dlt/1916

I'm trying something new and got an old project working with EWS (Exchange WebService) and I'm trying to debug, as it's currently not working correctly. The error I get is this one: fail:…
cV2
  • 5,229
  • 3
  • 43
  • 53
1
vote
1 answer

C# WPF catch exception in subform called by winform

I have a WPF application that calls a winforms subform. The winform calls a WPF window using showDialog(). The WPF window contains borders that I am setting the background image of. My problem is this. If an image that is being loaded has a problem,…
1
vote
1 answer

RichTextBox.RTF setter throwing System.ArgumentException. File format is not valid in Windows version 1803

The following scenario is simulated to reproduce the crash: Enable Beta: unicode UTF-8 for world wide language support (To enable Start=> Region & Language settings => Related settings -> Additional date, time & regional settings => Region ->…
MV Sreedhar
  • 339
  • 2
  • 7
1
vote
2 answers

UI Automation (UIA) RaiseAutomationPropertyChangedEvent Exception "Value does not fall within the expected range"

I'm currently trying to implement Move(double x, double y) as part of ITransformProvider within the UI Automation Provider API. The specifications say that after moving an element, I must raise a BoundingRectangleProperty changed event. // Save…
1
vote
1 answer

System.ArgumentException on Infragistics TabManager

i got the folowing error after adding new tab in infragistics's tab manager "System.ArgumentException: Parameter is not valid" this error shows on designer, so I can't debug it.. it does no accur immeadiatly after adding a new tab, just after…
unicorn
  • 829
  • 2
  • 8
  • 13
1
vote
1 answer

Method with two index parameters, where valid range interdependent: ArgumentOutOfRangeException OR ArgumentException?

Consider the following scenario: A method expects two indexes to be determined as parameters, and one of them to be equal to or greater than the other, making the valid range interdependent. For example, a method to get a sub-copy of an array, with…
CosmicGiant
  • 6,275
  • 5
  • 43
  • 58
1
vote
1 answer

UWP C# Getting All Files From Selected Folder

I'm trying to get a list of all files in a selected folder using UWP and C#. I need to select a folder and display all audio files in that folder (including subfolders of the root folder I have the following code: var folderPicker = new…
user3733885
  • 381
  • 2
  • 16
1
vote
2 answers

Should I throw an ArgumentException?

This question is about convention and interpreting MSDN, so I don't think it's primarily opinion based. I'm wondering about ArgumentException: I have a builder class which is used to build a filter object that will be applied when retrieving a set…
rory.ap
  • 34,009
  • 10
  • 83
  • 174
1
vote
0 answers

Destination array was not long enough

I have a List which is copied from another List, which throws an exception of "System.ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds". The exception thrown code is…
Amal
  • 576
  • 1
  • 6
  • 26
1
vote
1 answer

System.ArgumentException on putting AxWMPLib.AxWindowsMediaPlayer in Form

I have a standard Form with only a AxWMPLib.AxWindowsMediaPlayer and no code except autogenerated. I get System.ArgumentException twice on every app start. It says, that object does not provide IPropertyNotifySink interface. But how to implement it,…
JustLogin
  • 1,822
  • 5
  • 28
  • 50
1
vote
3 answers

Application.Run throws ArgumentException was unhandled

I have a condition in which I need to close the application and so I call this.Dispose () when I set a certian flag. At first I thought it was a problem of calling functions after I call this.Dispose () and so I moved the code to be the last thing…
Matt
  • 1,862
  • 2
  • 17
  • 19
1
vote
0 answers

Sharepoint 2010 workflow failes with "0x80070057"

I have created a simple Sharepoint 2010 site workflow that creates and manipulates tasks in a list. All my activities execute properly, but when the workflow is about to get to the end (the red point in the diagram :)) some nasty exception…
1
vote
1 answer

Argument Exception was unhandled (Entity Framework, WCF)

I have created one basic WCF Service. It thrown an exception at line shown below. ServiceHost host = new ServiceHost(typeof(MyApplication.ITransactionService1)); An unhandled exception of type 'System.ArgumentException' occurred in…