Access Violatio when adressing the Scripting.Dictionary object 
Author Message
 Access Violatio when adressing the Scripting.Dictionary object

I got a dll using the Dictionary object to store public types with nested
types of a class.
When I assign
var = mDicScriptStep.Item(Line)

I get an access violation "Memory could not be read"

I've been working a lot with the dictonary object before but
I never observed this strange behavior.

Does anybody observe anything similar?

Best regards

Volker

###########################

Project:

Type=OleDll

CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=1
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
ThreadingModel=1
DebugStartupOption=0

#########################

Code (in a class):

Private mDicScriptStep As Dictionary
Private mDicStepName As Dictionary

[..]

Public Enum ValueTypeConstants
    vtcEmpty = 0
    vtcVoltage = 1
    vtcCurrent = 2
    vtcOther = 3
End Enum

Public Type ScriptValueType
    ValueType As ValueTypeConstants
    Value As Single
    Description As String
End Type

Public Type ScriptStepType
    Line As Long
    Values(0 To MAX_COLS - 1) As ScriptValueType
End Type

[...]

Private Sub Class_Initialize()
    Set mDicScriptStep = New Dictionary
    Set mDicStepName = New Dictionary
End Sub

Private Sub Class_Terminate()
    Set mDicScriptStep = Nothing
    Set mDicStepName = Nothing
End Sub

Public Function GetScriptStep(Line As Long) As ScriptStepType
    Dim var As ScriptStepType
    If mDicScriptStep.Exists(Line) Then
        var = mDicScriptStep.Item(Line)
<-- after executing this line I get an access violation
        GetScriptStep = var
    End If
End Function



Sun, 12 Sep 2004 22:31:08 GMT  
 Access Violatio when adressing the Scripting.Dictionary object
Shouldn't that be a Set?  The Item is an object, no?

D?


| I got a dll using the Dictionary object to store public types with nested
| types of a class.
| When I assign
| var = mDicScriptStep.Item(Line)
|
| I get an access violation "Memory could not be read"
|
| I've been working a lot with the dictonary object before but
| I never observed this strange behavior.
|
| Does anybody observe anything similar?
|
| Best regards
|
| Volker
|
| ###########################
|
| Project:
|
| Type=OleDll
|
| CompilationType=0
| OptimizationType=0
| FavorPentiumPro(tm)=0
| CodeViewDebugInfo=0
| NoAliasing=0
| BoundsCheck=0
| OverflowCheck=0
| FlPointCheck=0
| FDIVCheck=0
| UnroundedFP=0
| StartMode=1
| Unattended=0
| Retained=0
| ThreadPerObject=0
| MaxNumberOfThreads=1
| ThreadingModel=1
| DebugStartupOption=0
|
| #########################
|
| Code (in a class):
|
| Private mDicScriptStep As Dictionary
| Private mDicStepName As Dictionary
|
| [..]
|
| Public Enum ValueTypeConstants
|     vtcEmpty = 0
|     vtcVoltage = 1
|     vtcCurrent = 2
|     vtcOther = 3
| End Enum
|
| Public Type ScriptValueType
|     ValueType As ValueTypeConstants
|     Value As Single
|     Description As String
| End Type
|
| Public Type ScriptStepType
|     Line As Long
|     Values(0 To MAX_COLS - 1) As ScriptValueType
| End Type
|
| [...]
|
| Private Sub Class_Initialize()
|     Set mDicScriptStep = New Dictionary
|     Set mDicStepName = New Dictionary
| End Sub
|
| Private Sub Class_Terminate()
|     Set mDicScriptStep = Nothing
|     Set mDicStepName = Nothing
| End Sub
|
| Public Function GetScriptStep(Line As Long) As ScriptStepType
|     Dim var As ScriptStepType
|     If mDicScriptStep.Exists(Line) Then
|         var = mDicScriptStep.Item(Line)
| <-- after executing this line I get an access violation
|         GetScriptStep = var
|     End If
| End Function
|
|



Sun, 12 Sep 2004 23:48:49 GMT  
 Access Violatio when adressing the Scripting.Dictionary object
No - it's just a typed variable.
If it was, there wouldn't be an violation but just an run time error.

Volker


Quote:
> Shouldn't that be a Set?  The Item is an object, no?

> D?




Quote:
> | I got a dll using the Dictionary object to store public types with
nested
> | types of a class.
> | When I assign
> | var = mDicScriptStep.Item(Line)
> |
> | I get an access violation "Memory could not be read"
> |
> | I've been working a lot with the dictonary object before but
> | I never observed this strange behavior.
> |
> | Does anybody observe anything similar?
> |
> | Best regards
> |
> | Volker
> |
> | ###########################
> |
> | Project:
> |
> | Type=OleDll
> |
> | CompilationType=0
> | OptimizationType=0
> | FavorPentiumPro(tm)=0
> | CodeViewDebugInfo=0
> | NoAliasing=0
> | BoundsCheck=0
> | OverflowCheck=0
> | FlPointCheck=0
> | FDIVCheck=0
> | UnroundedFP=0
> | StartMode=1
> | Unattended=0
> | Retained=0
> | ThreadPerObject=0
> | MaxNumberOfThreads=1
> | ThreadingModel=1
> | DebugStartupOption=0
> |
> | #########################
> |
> | Code (in a class):
> |
> | Private mDicScriptStep As Dictionary
> | Private mDicStepName As Dictionary
> |
> | [..]
> |
> | Public Enum ValueTypeConstants
> |     vtcEmpty = 0
> |     vtcVoltage = 1
> |     vtcCurrent = 2
> |     vtcOther = 3
> | End Enum
> |
> | Public Type ScriptValueType
> |     ValueType As ValueTypeConstants
> |     Value As Single
> |     Description As String
> | End Type
> |
> | Public Type ScriptStepType
> |     Line As Long
> |     Values(0 To MAX_COLS - 1) As ScriptValueType
> | End Type
> |
> | [...]
> |
> | Private Sub Class_Initialize()
> |     Set mDicScriptStep = New Dictionary
> |     Set mDicStepName = New Dictionary
> | End Sub
> |
> | Private Sub Class_Terminate()
> |     Set mDicScriptStep = Nothing
> |     Set mDicStepName = Nothing
> | End Sub
> |
> | Public Function GetScriptStep(Line As Long) As ScriptStepType
> |     Dim var As ScriptStepType
> |     If mDicScriptStep.Exists(Line) Then
> |         var = mDicScriptStep.Item(Line)
> | <-- after executing this line I get an access violation
> |         GetScriptStep = var
> |     End If
> | End Function
> |
> |



Mon, 13 Sep 2004 00:47:55 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Severe Problem with objects containing Collections both in Scripting.Dictionary and VB 5.0 object

2. dictionary object failure when using nested dictionary objects

3. Scripting.Dictionary Objects

4. scripting.dictionary object confusion...

5. Objects and Scripting Dictionaries

6. Enumerating the Dictionary scripting object !!!

7. Scripting.Dictionary object to IMAGE field

8. Storing Scripting.Dictionary object to SQLserver IMAGE field

9. Scripting.Dictionary object to IMAGE field

10. Enumerating the Dictionary scripting object !!!

11. Can't Access Whole Array from within a Dictionary Object

12. Accessing script variables through the script object

 

 
Powered by phpBB® Forum Software