I am using Janus Schedule dll (and other Janus references like janus.common, janus.calendar.dll) to save appointments in a xml file (I am using Janus Winforsv

control suite v 3.0).

I have succesfully run the app in my pc, but when running the program in other pc, the program fails when calling the SaveAppointments method, the error comes at Schedule1.SaveAppointments(stream)...

The method is:

Private Sub SaveAppointments()
        Dim stream As System.IO.Stream
        If (fileName Is Nothing) Then
            If (saveFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK) Then
                fileName = saveFileDialog1.FileName
                stream = saveFileDialog1.OpenFile()
            Else
                Return
            End If
        Else
            stream = New System.IO.FileStream(fileName, System.IO.FileMode.Create)
            stream.Position = 0

             Schedule1.SaveAppointments(stream)  ''*******HERE IS THE ERROR      

           stream.Close()

            stream = Nothing

            appointmentsChanged = False
        End If
    End Sub

The error I get is:

 System.TypeLoadException: Abstract Method with non-zero RVA    
at  Janus.Windows.Common.Layouts.PropertyValue.a(XmlWriter , IJanusLayout 
at Janus.Windows.Common.Layouts.JanusLayoutWriter.a(XmlWriter ,  IJanusLayout )    
at Janus.Windows.Common.Layouts.JanusLayoutWriter.FillStream(Stream  stream)
at Janus.Windows.Schedule.Schedule.SaveAppointments(Stream  stream)   
at FOEA.MainForm.SaveAppointments()
at C:\FOE\UI\MainForm.vb:línea 78    
at FOEA.MainForm.MainMenu_Click(Object sender, EventArgs e) 
at C:\FOEA\UI\MainForm.vb:line 143    
at  System.Windows.Forms.MenuItem.OnClick(EventArgs e)    
at System.Windows.Forms.MenuItem.MenuItemData.Execute()    
at System.Windows.Forms.Command.Invoke()    
at System.Windows.Forms.Command.DispatchID(Int32 id)    
at System.Windows.Forms.Control.WmCommand(Message& m)    
at System.Windows.Forms.Control.WndProc(Message& m)    
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)    
at System.Windows.Forms.ContainerControl.WndProc(Message& m)    
at System.Windows.Forms.Form.WndProc(Message& m)    
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) 
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Fisrt I was suspecting that the target PC needs to have .NET 3.5 for the Xml.linq.dll, but I referenced the dlls and then I assigned Copy local to true, and added all necesary dlls, still throws that error...

Other guess is the name of the System.Xml.dll is not the same as the dll in my bin directory (System.XML.dll) maybe the upper case is making vb.net not to recognize the xml dll?, but I don ot thing this has to do with the erro.

I have installed:

  • Microsoft .NET 4 Framework Client Profile
  • Microsoft .NET 4 Framework Extended
  • MSXML 4.0 SP2 Parser and SDK
  • MSXML 4.0 SP3 Parser

on target pc but that didn't work... When getting that error the contents of xml file are deleted, The file schedule.xml is still there and empty.

I do not know what to do because the program runs in my pc and other I have, but is not running in the target PC... Do you think I should install Janus winforms on target PC? maybe that woulc work

有帮助吗?

解决方案

I have used Janus sometime ago. The method to save appointments that I used is:

 Private Sub SaveAppointments()
        Me.Cursor = Cursors.WaitCursor
        Dim appointmentsDir As String = "yourAppsFile.xml"
        Dim appointmentsStream As System.IO.FileStream
        appointmentsStream = New System.IO.FileStream(appointmentsDir, System.IO.FileMode.Create)
        Schedule1.SaveAppointments(appointmentsStream)
        appointmentsStream.Close()
        Me.Cursor = Cursors.Default
    End Sub

Also verify the xml file to have all roots and elements (well formed XML)

In Janus 3.5

<?xml version="1.0" encoding="utf-8"?>
<Schedule>
    <Fields Collection="true" ElementName="Field" />
    <Owners Collection="true" ElementName="Owner" />
    <Appointments Collection="true" ElementName="Appointment">
        <Appointment0>
            <Description>test </Description>
            <EndTime>10/10/2011 11:00:00</EndTime>
            <Text>test </Text>
            <StartTime>10/10/2011 10:30:00</StartTime>
        </Appointment0>           
    </Appointments>
</Schedule>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top