0 Replies Latest reply: Mar 21, 2011 10:34 AM by AntonZ RSS

    Error retrieving cache in c# WPF project (No problems in c# WinForms)

    AntonZ
      Hi!

      To put it simply, the same basic cache retrival (with same configuration files) works under c# Winform app but under c# WPF app returns an error: {"unable to convert type -6 to a Binary type"} from cache.GetValues(null);

      Working with a custom .net object, under VS 2010 SP1, .net 4. Coherence 3.5.2.46302. Win XP SP3.

      Is there any known issue related to this? Any differences or specifics in serialization/deserialization for wpf vs winforms?

      It connects and sees number of records properly (cache.Count) but fails on GetEntries or GetValues.

      Details below:

      WPF c# code
      -----------------------------------------------------------------------------------
      using System;
      using System.Collections.Generic;
      using System.Collections;
      using System.ComponentModel;
      using System.Data;
      using System.Linq;
      using System.Drawing;
      using System.Text;
      using System.Windows;
      using System.Windows.Controls;
      using System.Windows.Data;
      using System.Windows.Documents;
      using System.Windows.Input;
      using System.Windows.Media;
      using System.Windows.Media.Imaging;
      using System.Windows.Navigation;
      using System.Windows.Shapes;
      using RflxBlotter;
      
      using System.Configuration;
      
      using Tangosol.Net;
      using Tangosol.Net.Cache;
      using Tangosol.Net.Cache.Support;
      using Tangosol.Util;
      using Tangosol.Util.Extractor;
      using Tangosol.Util.Filter;
      
      namespace WPFGrid
      {
          /// <summary>
          /// Interaction logic for MainWindow.xaml
          /// </summary>
          public partial class MainWindow : Window
          {
              public MainWindow()
              {
                 InitializeComponent();
                 Cohe();
              }
      
               public void Cohe()
               {
                  INamedCache cache;
                  long tradeCount; 
      
                  cache = CacheFactory.GetCache("trade-cache");
                  tradeCount = cache.Count;
                  ICollection cacheEntries = cache.GetValues(null);
               }
          }
      }
      InnerException: {"unable to convert type -6 to a Binary type"}
      Source: Coherence
      InnerStack:

      at Tangosol.IO.Pof.PofStreamReader.ReadString(Int32 index)
      at RflxBlotter.RflxTrade.ReadExternal(IPofReader reader)
      at Tangosol.IO.Pof.PortableObjectSerializer.Deserialize(IPofReader reader)
      at Tangosol.IO.Pof.PofStreamReader.ReadAsObject(Int32 typeId)
      at Tangosol.IO.Pof.PofStreamReader.ReadObject(Int32 index)
      at Tangosol.IO.Pof.ConfigurablePofContext.Deserialize(DataReader reader)
      at Tangosol.Net.Impl.RemoteNamedCache.ConverterFromBinary.Convert(Object o)
      at Tangosol.Util.ConverterCollections.ConvertArray(Object[] ao, IConverter conv)
      at Tangosol.Util.ConverterCollections.ConverterCollection.CopyTo(Array array, Int32 index)
      at Tangosol.Util.ConverterCollections.ConverterQueryCache.GetValues(IFilter filter)
      at Tangosol.Util.ConverterCollections.ConverterNamedCache.GetValues(IFilter filter)
      at Tangosol.Net.Impl.RemoteNamedCache.GetValues(IFilter filter)
      at Tangosol.Net.Impl.SafeNamedCache.GetValues(IFilter filter)
      at WPFGrid.MainWindow.Cohe() in C:\Projects\BlotterTestGrid1\WpfGrid\MainWindow.xaml.cs:line 49
      at WPFGrid.MainWindow..ctor() in C:\Projects\BlotterTestGrid1\WpfGrid\MainWindow.xaml.cs:line 40



      WinForms c# code
      -----------------------------------------------------------------------------------
      using System;
      using System.Collections.Generic;
      using System.Collections;
      using System.ComponentModel;
      using System.Data;
      using System.Drawing;
      using System.Text;
      using System.Windows.Forms;
      using RflxBlotter;
      
      using DevExpress.XtraGrid.Views.Grid;
      using DevExpress.XtraVerticalGrid;
      
      using Tangosol.Net;
      using Tangosol.Net.Cache;
      using Tangosol.Net.Cache.Support;
      using Tangosol.Util;
      using Tangosol.Util.Extractor;
      using Tangosol.Util.Filter;
      
      namespace WimFormsGrid
      {
              private INamedCache cache;
              private long tradeCount; 
      
        public partial class Form1 : Form
        {
      
          public Form1()
          {
              InitializeComponent();
          }
      
          private void Form1_Load(object sender, EventArgs e)
          {
              cache = CacheFactory.GetCache("trade-cache");
              tradeCount = cache.Count;
              ICollection cacheEntries = cache.GetValues(null);
          }
        }
      }