Click here to Skip to main content
15,898,035 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Function doesn't make sense Pin
Dave Kreskowiak12-Jun-07 12:50
mveDave Kreskowiak12-Jun-07 12:50 
GeneralRe: Function doesn't make sense Pin
Richard Jones13-Jun-07 1:38
Richard Jones13-Jun-07 1:38 
GeneralRe: Function doesn't make sense Pin
Dave Kreskowiak13-Jun-07 3:09
mveDave Kreskowiak13-Jun-07 3:09 
GeneralRe: Function doesn't make sense Pin
Richard Jones13-Jun-07 3:35
Richard Jones13-Jun-07 3:35 
GeneralRe: Function doesn't make sense Pin
Dave Kreskowiak13-Jun-07 7:02
mveDave Kreskowiak13-Jun-07 7:02 
GeneralRe: Function doesn't make sense Pin
Richard Jones13-Jun-07 7:36
Richard Jones13-Jun-07 7:36 
GeneralRe: Function doesn't make sense Pin
Steven J Jowett12-Jun-07 3:56
Steven J Jowett12-Jun-07 3:56 
QuestionCan't DeSerialize, but can Serialize with unknown object type :( Pin
twista12-Jun-07 3:00
twista12-Jun-07 3:00 
Hi,

Background:
Plugin Application.
TestPlugin.exe file is loaded into the main program using reflection. (this works)
Main program calls "ShowConfig()" plugin function using reflection invoke(obj, args),
and the plugin displays the config window,
user sets his config, clicks OK, window disappears
showconfig() passes back a reference to the "TestConfigObj" in the args
TestConfigObj is also public inside the TestPlugin.exe assembly.
Looking at the "args(0)" - it correctly shows the TestConfigObj.myconfigvars

Main Test program now wishes to take a clone of this "object"

BUT

this code is throwing this exception when I try and clone the "object",

<br />
  Function ObjectCopy(ByVal obj As Object, ByVal AssemblyFileName As String) As Object<br />
    'copies original object to stream then <br />
    'deserializes that stream and returns the output<br />
    'to create clone (copy) of object<br />
<br />
    Dim objMemStream As New MemoryStream(5000)<br />
    Dim objBinaryFormatter As New BinaryFormatter(Nothing, _<br />
        New StreamingContext(StreamingContextStates.Clone))<br />
<br />
    ' make sure our assembly is loaded!<br />
    ' System.Reflection.Assembly.LoadFile(AssemblyFileName)<br />
<br />
    ' output the object, reset pointer and input the object back again<br />
    objBinaryFormatter.Serialize(objMemStream, obj) ' *** THIS LINE(1) IS OK - Mouse hover shows ME ASSEMBLY BREAKDOWN OF 'Obj'<br />
    objMemStream.Seek(0, SeekOrigin.Begin)<br />
    ObjectCopy = objBinaryFormatter.Deserialize(objMemStream) ' *** THIS LINE(2) THROWS UNKNOWN ASSEMBLY<br />
<br />
    objMemStream.Close()<br />
end Function<br />


Exception:
<br />
System.Runtime.Serialization.SerializationException was unhandled<br />
  Message="Unable to find assembly 'CTPTestDemo1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'."<br />
  Source="mscorlib"<br />
  StackTrace:<br />
       at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()<br />
       at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name)<br />
       at System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String objectName, String[] <br />
...<br />


However, when I hover the mouse over line(1) 'obj' I get:

<br />
- obj | { CTPTestDemo1.TestConfigObj }<br />
  - CTPTestDemo1.TestConfigObj | { CTPTestDemo1.TestConfigObj }<br />
    - Iterations | 12345<br />


I have tried loading the CTPTestDemo1 assembly just before I serialize, but this doesn't work
(hence why I have commented it out again)

Why can the mouse hover give me the correct "TestConfigObj" details, and serialize it,
but can't deserialize it back into the new object?

I have gone through the GetReferencedAssemblies() but the CTPTestDemo assembled is not listed in this collection.

I also only have ONE version of the CTPTestDemo assmebly (.exe file)

I do not want to reference in the MainApps References the TestPlugin.Exe Assembly - as these are test Plugin's and so the mainapp should not need to know about them

Any Ideas would be greatfully received!

Thanks,
Phil.
Questionwindows schedular is not working Pin
srinivassam12-Jun-07 2:19
srinivassam12-Jun-07 2:19 
AnswerFOUR instances of a question you asked on June 4th Pin
leckey12-Jun-07 4:03
leckey12-Jun-07 4:03 
GeneralRe: FOUR instances of a question you asked on June 4th Pin
Colin Angus Mackay12-Jun-07 4:08
Colin Angus Mackay12-Jun-07 4:08 
GeneralRe: FOUR instances of a question you asked on June 4th Pin
leckey12-Jun-07 4:23
leckey12-Jun-07 4:23 
Questionwindows based schedular not working Pin
srinivassam12-Jun-07 2:15
srinivassam12-Jun-07 2:15 
Questionwindows based schedular not working Pin
srinivassam12-Jun-07 2:15
srinivassam12-Jun-07 2:15 
AnswerRe: windows based schedular not working Pin
Tarakeshwar Reddy12-Jun-07 2:54
professionalTarakeshwar Reddy12-Jun-07 2:54 
QuestionPath Pin
Brendan Vogt12-Jun-07 1:18
Brendan Vogt12-Jun-07 1:18 
AnswerRe: Path Pin
PandemoniumPasha12-Jun-07 1:42
PandemoniumPasha12-Jun-07 1:42 
QuestionRe: Path Pin
Brendan Vogt12-Jun-07 1:58
Brendan Vogt12-Jun-07 1:58 
AnswerRe: Path Pin
Steven J Jowett12-Jun-07 2:01
Steven J Jowett12-Jun-07 2:01 
QuestionCombobox data connetivity [modified] Pin
Aman.Jen12-Jun-07 0:35
Aman.Jen12-Jun-07 0:35 
AnswerRe: Combobox data connetivity Pin
Christian Graus12-Jun-07 2:04
protectorChristian Graus12-Jun-07 2:04 
Questioncreate chart by vb.net Pin
xuyuan11-Jun-07 23:26
xuyuan11-Jun-07 23:26 
AnswerRe: create chart by vb.net Pin
Christian Graus12-Jun-07 1:43
protectorChristian Graus12-Jun-07 1:43 
Questionwindows schedular is not running Pin
srinivassam11-Jun-07 20:45
srinivassam11-Jun-07 20:45 
Questionexecute a command to TURN ON THE PC ON A SPECIFIC TIME Pin
koolprasad200311-Jun-07 19:35
professionalkoolprasad200311-Jun-07 19:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.