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
0
votes
1 answer

ArgumentException occurs randomly

Sometimes when my application tries to start, the ArgumentException "The parameter is incorrect" is thrown. Unfortunately the exception occurs randomly, so it is hard to fix it. InnerException and StackTrace are empty :(. Here is…
Michal
  • 343
  • 1
  • 5
  • 16
0
votes
1 answer

create too big BMP file in Ram produce argument exception

My code: Dim bmp_ As New Bitmap(width, height) ' here is for-loop to fill up bitmap ( bmp_.SetPixel(x, y, Color.White) ) bmp_.Save("D:\test.bmp", ImageFormat.Bmp) That is working correctly for small files, but if i try this: Dim bmp_ As New…
ns27
  • 3
  • 3
0
votes
1 answer

ArgumentException Message displayed in a Label

public void DeleteUser(User user) { if (!UserExists(user)) throw new ArgumentException("User doesn't exist!"); else { MatrixDb.Users.Remove(user); MatrixDb.SaveChanges(); } …
Sorrel Vesper
  • 414
  • 4
  • 18
0
votes
1 answer

ASP.NET Master Page: Event Validation Error

I included a repeater in my master page. The repeater has a button that I set its CommandArgument. However when I click the button I get the following exception: System.ArgumentException: Invalid postback or callback argument. Event validation is…
Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
0
votes
1 answer

How do I acces the width and height of an Bitmap in C# XNA?

I am trying to create a application where I create a Bitmap, and then take some variables out of it and make a Texture2D from it. This is what I've got: public Bitmap getBitmap() { if (!panelVideoPreview.IsDisposed) …
tversteeg
  • 4,717
  • 10
  • 42
  • 77
0
votes
1 answer

FileStream Exception

byte[] bFileName = new byte[512]; r2Socket.Receive(bFileName); String FileName = Encoding.UTF8.GetString(bFileName); System.Windows.Forms.MessageBox.Show(FileName); // It's Ok. Show FileName = "text.jpg" FileStream = new FileStream("D:\\" +…
Andrey
  • 39
  • 8
-1
votes
1 answer

Why does: '18 is not a valid value for the property "System.Windows.Documents.TextElement.FontSize" on a setter.' get thrown when setting FontSize?

I want to create a "DataGrid" in "WPF" when a "Button" is pressed. Everything went fine, until I wanted to change the "FontSize" of the "ColumnHeader". My Code so far: var list = new ObservableCollection { …
SoulB
  • 68
  • 7
-1
votes
2 answers

System.ArgumentException: 'Object of type 'myObject' cannot be converted to type 'System.Collections.Generic.List`1[myObject]'.'

I need to create a generic list of T by reflection and add item of T to it by invoke a method "Add", but I have error. this is my code: public class myObject { public object FieldValue { get; set; } public int ID_OpenField { get; set;…
bama71
  • 11
  • 1
-1
votes
1 answer

Getting the original error message out of an ArgumentException

When writing classes for internal processing in .Net, I often use ArgumentException to indicate something is wrong with the given data and it can't be processed. Due to the nature of the program, the text I put in these exceptions is sometimes…
Nyerguds
  • 5,360
  • 1
  • 31
  • 63
-1
votes
1 answer

ArgumentException: The node to be inserted is from a different document context

I've searched Stackoverflow on this question, as well as other forums but no one seems to be making this the way I'm making. By this I mean, in my code, instead of using XMLNode, I'm using XMLElement. So, without further ado, my intention is to save…
Dark Kool
  • 11
  • 1
  • 7
-1
votes
1 answer

Getting System.ArgumentException even while sending the right number of parameters while using Moq setup

While unit testing my ASP.NET web api controllers,for one of my post requests, I am sending two arguments in the repo function, Like usual I am mocking the repository setup, but even when I send two arguments, I get the argument exception. Repo…
-1
votes
1 answer

ArgumentException: Value does not fall within the expected range. - Fails to add strings to data structures

I have a function to create a graph and add some values to a few other data structures using a StreamReader to read in lines from a .txt file. public static DirectedGraph GetGraph(string fn) { DirectedGraph dg = new…
Jared
  • 11
  • 2
-1
votes
1 answer

it says "try specifying the type arguments explicitly". i have a problem with AddModulesAsync, tryin to make a bot

I was trying to make a new Discord Bot with Discord.NET packages and I think it's done. Only command codes are waiting. Now I couldn't figure out what's this saying and how can I get this over with. I tried to change "AddModulesAsync" to…
-1
votes
2 answers

Error using Action(T, object)

I'm debugging someone else's source code, and I'm not really sure how it works, so am a bit stuck. This code: List source = new List(); for (int ordinal = 0; ordinal < dbDataReader.FieldCount; ++ordinal) …
radders
  • 923
  • 8
  • 29
-1
votes
1 answer

base.OnPaint(e) ArgumentException

I have my own class that extends of PictureBox. I have a problem when I draw a circle arround it. The problem was on the "base.OnPaint(e)" and it throws an ArgumentException. I put the code below and then the complete class. The method that throws…
Imrik
  • 674
  • 2
  • 14
  • 32
1 2 3
15
16