-
Oct 25th, 2011, 08:49 AM
#1
Thread Starter
Fanatic Member
-
Oct 25th, 2011, 09:01 AM
#2
Re: {"An invalid argument was supplied"}
Are you using sockets? Are they in a class instance, or part of a form? If they are a class instance, is an instance created on startup, or is the first instance created in code at a later time? I would guess that you are creating an instance with a line like this:
Private mySocket = New MySocketContainingClass
form level variables on the startup form, or similar global variables in a module, will be created before the program officially starts, which makes them interesting to debug.
My usual boring signature: Nothing
-
Oct 25th, 2011, 09:52 AM
#3
Thread Starter
Fanatic Member
Re: {"An invalid argument was supplied"}
I haven't changed anything from the working version and this version. I opened my project and now I get this issue.
Two weeks ago I was able to run this just fine, without any changes.
I use Microsofts FTP WebRequest and FTP WebResponse classes.
vb Code:
Private Shared _ftp As FtpWebRequest
Private Shared _ftpResponse As FtpWebResponse
I use that with a URI builder.
Because I'm getting this error message, I believe it's got something to do with .Net framework.
Take a look at the call stack location in the image below.
RATE THOSE WHO ARE HELPFUL PLEASE!!
-
Oct 25th, 2011, 10:42 AM
#4
Re: {"An invalid argument was supplied"}
Actually, I'm not all that surprised by it suddenly happening, though I wouldn't be too quick to blame the framework. The thing is that you are dealing with a network. Those shared variables could certainly cause issues, though not from the code you just posted. All that does is declare the variables, it doesn't create the instances. When do you create the instances? Does that happen in an exception handler?
What I am thinking is that they are failing as they are being created due to some issue with the network, itself, having changed some. That could be an internal error, but it is pretty unlikely. More likely, if you could narrow it down, you'd be able to figure it out. Therefore, I'd be taking a look at where the shared objects are being created, and the code around them.
My usual boring signature: Nothing
-
Oct 25th, 2011, 10:53 AM
#5
Thread Starter
Fanatic Member
Re: {"An invalid argument was supplied"}
Ok, so this is how I declare my FTPWebRequest and Reponse.
vb.net Code:
Private Shared _ftp As FtpWebRequest
Private Shared _ftpResponse As FtpWebResponse
Private Shared _builderURI As UriBuilder = New UriBuilder
Private Shared _ftpURI As Uri
Private Shared _username As String
Private Shared _password As String
Private Shared _hostname As String = "ww2.hostname.com"
Public Shared Property ftpRequest() As FtpWebRequest
Get
Return _ftp
End Get
Set(ByVal value As FtpWebRequest)
_ftp = value
End Set
End Property
Public Shared Property ftpResponse() As FtpWebResponse
Get
Return _ftpResponse
End Get
Set(ByVal value As FtpWebResponse)
_ftpResponse = value
End Set
End Property
Public Shared Property builderURI() As UriBuilder
Get
Return _builderURI
End Get
Set(ByVal value As UriBuilder)
_builderURI = value
End Set
End Property
Public Shared Property ftpURI() As Uri
Get
Return _ftpURI
End Get
Set(ByVal value As Uri)
_ftpURI = value
End Set
End Property
Public Shared Property Username() As String
Get
Return _username
End Get
Set(ByVal value As String)
_username = value
End Set
End Property
Public Shared Property Password() As String
Get
Return _password
End Get
Set(ByVal value As String)
_password = value
End Set
End Property
Public Shared Property Hostname() As String
Get
Return _hostname
End Get
Set(ByVal value As String)
_hostname = value
End Set
End Property
Public Shared Property Method() As String
Get
Return _method
End Get
Set(ByVal value As String)
If Not ftpRequest Is Nothing Then
ftpRequest.Method = value
End If
_method = value
End Set
End Property
Public Shared Sub BuildURI()
Try
WriteToEventLog("Building URI....")
builderURI.Host = Hostname
builderURI.Password = Password
builderURI.UserName = Username
builderURI.Port = 21
' builderURI.Path = "testing/" 'TODO: REMOVE after testing
builderURI.Scheme = Uri.UriSchemeFtp
Debug.Print(builderURI.Uri.ToString)
ftpURI = builderURI.Uri
WriteToEventLog("Building URI Completed!")
Catch ex As Exception
Debug.Print(ex.Message)
WriteToEventLog(ex)
End Try
End Sub
''' <summary>
''' This will create the FtpWebRequest and then set the request method to the method defined.
''' </summary>
''' <remarks>This must be called after BuildURI</remarks>
Public Shared Sub CreateRequest()
Try
ftpRequest = FtpWebRequest.Create(ftpURI)
'ftpRequest.Method = Method
Catch ex As Exception
WriteToEventLog(ex)
End Try
End Sub
''' <summary>
''' Get the StatusDescription from the last method requested. IE: get the returned Status Code/Description.
''' </summary>
''' <remarks>Call this after every request.</remarks>
Public Shared Function GetServerStatus()
Try
ftpResponse = ftpRequest.GetResponse()
RaiseEvent OnFtpStatusChanged(Nothing, New FtpStatusChangedEventArgs(ftpResponse.StatusDescription)) 'response))
Dim response As String = Strings.Right(ftpResponse.StatusDescription, ftpResponse.StatusDescription.Length - 4)
'WriteToEventLog("Server Status = " & response)
_serverStatus = response
Return response
Catch ex As Exception
WriteToEventLog(ex)
Return Nothing
End Try
End Function
Last edited by TheUsed; Oct 25th, 2011 at 11:59 AM.
RATE THOSE WHO ARE HELPFUL PLEASE!!
-
Oct 25th, 2011, 12:01 PM
#6
Thread Starter
Fanatic Member
-
Oct 25th, 2011, 12:03 PM
#7
Thread Starter
Fanatic Member
-
Oct 25th, 2011, 02:50 PM
#8
Re: {"An invalid argument was supplied"}
Not much there that looks like it could be related. I take it you aren't getting any items popping up in your event log?
Still, from the looks of it, you have exhausted that line of reasoning. Would I be correct in assuming that you aren't using any sockets directly, only whatever is being used for the FTP communication?
My usual boring signature: Nothing
-
Oct 26th, 2011, 11:36 AM
#9
Thread Starter
Fanatic Member
Re: {"An invalid argument was supplied"}
Originally Posted by Shaggy Hiker
Not much there that looks like it could be related. I take it you aren't getting any items popping up in your event log?
Still, from the looks of it, you have exhausted that line of reasoning. Would I be correct in assuming that you aren't using any sockets directly, only whatever is being used for the FTP communication?
My event log does not show anything related to this issue. (just information events that show service start and stop times)
You are correct that I am not using sockets directly. I am only using FtpWebRequest and FtpWebResponse that pertain to the .net framework.
Im at a loss, I know that this error happening is going to withhold the ability to update the program as requested by my supervisor.
I may just reinstall the framework(altho i've tried, Windows 7 is a stubborn pain in the ass when it comes to doing this.)
RATE THOSE WHO ARE HELPFUL PLEASE!!
-
Oct 28th, 2011, 03:56 PM
#10
Thread Starter
Fanatic Member
-
Oct 28th, 2011, 04:08 PM
#11
Thread Starter
Fanatic Member
-
Oct 28th, 2011, 04:12 PM
#12
Thread Starter
Fanatic Member
-
Nov 1st, 2011, 09:17 AM
#13
Thread Starter
Fanatic Member
-
Nov 1st, 2011, 09:29 AM
#14
Re: {"An invalid argument was supplied"}
Yeah, I've run into issues opening projects on a network share. In my case, the problem wasn't worth studying, so I can't say anything more about it. I just moved the project local, which is where it kind of made sense, in my case.
My usual boring signature: Nothing
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|