[RESOLVED] Value of type typename1 cannot be converted to typename1
I have 5 projects in the solution, everything worked until I recompiled everything updated the DLL's and now in one of my projects I have this error, the typename1 = typename1, anyone seen this problem?
Re: Value of type typename1 cannot be converted to typename1
What is typename1? make sure its not defined in 2 places...
Re: Value of type typename1 cannot be converted to typename1
Hi, it's not defined multiple times.
Here is the code, tSteps is defined in the declarations of the class as Dim tSteps As CollectionLibrary.CollectionLib.TestSteps. Then I instantiate it in the sub, I highlighted it red where I get the error
Code:
Public Sub RunTestStep()
If tStepEngine Is Nothing Then tStepEngine = New BEITestSteps.TestEngine
If tSteps Is Nothing Then tSteps = New CollectionLibrary.CollectionLib.TestSteps
Dim iStep As Integer
Dim logEvent As String
stepCount = tSteps.Count
For iStep = 0 To stepCount Step iStep + 1
logEvent = DateTime.Now & " - Starting Test Step: " & tSteps.Item(iStep).FunctionName
RaiseEvent WriteLog(logEvent)
logEvent = "Starting Test Sequence: " & tSteps.Item(iStep).Sequence
RaiseEvent WriteLog(logEvent)
logEvent = tSteps.Item(iStep).Param1
RaiseEvent WriteLog(logEvent)
logEvent = "Config ID: " & tSteps.Item(iStep).ConfigId & " Seq#: " & iStep
RaiseEvent WriteLog(logEvent)
tStepEngine.ExecuteTestStep(iStep, tSteps)
If Not tStepEngine.Pass Then
' step failed, we should do something here
logEvent = DateTime.Now & " - FAILED " & tSteps.Item(iStep).FunctionName
RaiseEvent WriteLog(logEvent)
Exit For
End If
logEvent = DateTime.Now & " - PASSED " & tSteps.Item(iStep).FunctionName
RaiseEvent WriteLog(logEvent)
If Not tStepEngine.NextIndex = iStep + 1 Then
iStep = tStepEngine.NextIndex
Else
End If
RaiseEvent StepCompleted(tStepEngine.Pass) 'add params becasue the main form does not have test step engine class
Next
End Sub
here is the sub it's calling in another project, there is no error here
Code:
Public Sub ExecuteTestStep(ByVal iStep As Integer, ByVal tstSteps As CollectionLibrary.CollectionLib.TestSteps)
If tstSteps Is Nothing Then tstSteps = New CollectionLibrary.CollectionLib.TestSteps
m_currentIndex = iStep
currentFunc = tstSteps.Item(m_currentIndex).FunctionName
currentParam1 = tstSteps.Item(m_currentIndex).Param1
currentParam2 = tstSteps.Item(m_currentIndex).Param2
currentParam3 = tstSteps.Item(m_currentIndex).Param3
currentParam4 = tstSteps.Item(m_currentIndex).Param4
currentParam5 = tstSteps.Item(m_currentIndex).Param5
m_startTime = DateTime.Now
_ExecuteTestStep()
m_testMessage = "PASSED " & currentFunc
m_stopTime = DateTime.Now
End Sub
As you can see both are the same types. Like I said it worked until I recompiled the CollectionLibrary DLL. Of course I reference the correct DLL's everywhere.
Re: Value of type typename1 cannot be converted to typename1
what does the code for tStepEngine.ExecuteTestStep look like?
Are these DLLs you have referenced or projects? Perhaps something is using an outdated DLL
Re: Value of type typename1 cannot be converted to typename1
The tStepEngine.ExecuteTestStep code is in the second code window I posted earlier.
I have 5 assemblies or projects that are referenced by dll in each other, and there is a hierarchy where I compile the first project then I reference that dll in another, I compile that and then I reference both (if needed) in another and so on. I have recompiled and re referenced everything about 10 times so I don't think it's referencing an outdated dll, at this point I don't know what causing this. The funny thing is that I haven't changed anything in this class, where the error started showing, and this piece of code has been working for 2 days just like I have it now. To make it worse, last time I checked the solution into SourceSafe was yesterday I have worked a lot on it since, I really hope this can be fixed without rolling back the version.
The exact error message in the task window is like this:
The value of Type CollectionLibrary.CollectionLib.TestSteps can not be converted to CollectionLibrary.CollectionLib.TestSteps.
It is obviously referring to the same class.
Re: Value of type typename1 cannot be converted to typename1
with the project closed, try deleting all the OBJ folders from each projects source. Also delete the compiled code in your BIN directory (you can delete the entire BIN directory, so long as there arent any files in there you need and wont get copied back on a recompile).
Then open your solution and try to compile again. I have seen where the OBJ folder gets screwed up and the apps are looking at wrongs versions of dlls, etc..
Re: Value of type typename1 cannot be converted to typename1
Thanks, I think that's exactly what happened somehow, I didn't even have to delete anything, all I did was closed the IDE and reopened it and it was fixed.
Also, I found a good msdn article from another VB forum, basically I was referencing files (the built dll) instead of referencing the project, the MS article says referencing the assembly instead of the file is a safer way that would eliminate these kind of things that happened to me.
http://msdn.microsoft.com/en-us/library/ms235244.aspx
Re: Value of type typename1 cannot be converted to typename1
yeah, I actually asked you that in post #4 above because a lot of times people don't realize they can reference the projects instead of compiled DLLs. This also makes it worlds easier to debug because you can step from project to project with breakpoints in the code
Re: [RESOLVED] Value of type typename1 cannot be converted to typename1
I know, and thanks, I wasn't aware that you could reference the whole project even though it was front of my face every time I had to re reference something.