Strange Error Message: Context converting

2 posts, 1 answers
  1. Christian
    Christian avatar
    81 posts
    Member since:
    Aug 2008

    Posted 01 Dec 2008 Link to this post

    Hello,
    I update my project from the ORM version 4.4 to the current one.
    I receive the error message:
    "The object of the type ' Context' cannot converted in type 'Context'"
    In German: Das Objekt des Typs "Context" kann nicht in Typ "Context" umgewandelt werden.

    I use this small project for testing:

    1 using System; 
    2 using System.Collections.Generic; 
    3 using System.Linq; 
    4 using System.Text; 
    5 using Telerik.OpenAccess; 
    6  
    7 namespace ConsoleApplication1 
    8
    9     class Program 
    10     { 
    11         static void Main(string[] args) 
    12         { 
    13             IObjectScope scope = Database.Get("Test001").GetObjectScope(); 
    14             scope.Transaction.Begin(); 
    15             Person MA = new Person(); 
    16             MA.Vorname = "Hans"
    17             MA.Nachname = "Test"
    18             scope.Add(MA); 
    19             scope.Transaction.Commit(); 
    20             scope.Dispose(); 
    21  
    22         } 
    23     } 
    24  
    25     [Telerik.OpenAccess.Persistent()] 
    26     internal class Person 
    27     { 
    28         private string vorname; 
    29         private string nachname; 
    30  
    31         internal Person(){} 
    32  
    33         public string Vorname 
    34         {get { return vorname;} 
    35             set { vorname = value;}} 
    36  
    37         public string Nachname 
    38         { 
    39             get { return nachname; } 
    40             set { nachname = value; } 
    41         } 
    42     } 
    43      
    44




    And the output windows reports:

    ------ Erstellen gestartet: Projekt: ConsoleApplication1, Konfiguration: Debug Any CPU ------ 
    c:\WINNT\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /unsafe+ /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:"C:\Programme\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Programme\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:c:\WINNT\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:c:\WINNT\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:c:\WINNT\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Programme\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /reference:"C:\Programme\Telerik\OpenAccess ORM\bin\Telerik.OpenAccess.dll" /reference:"C:\Programme\Telerik\OpenAccess ORM\bin\Telerik.OpenAccess.Query.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\ConsoleApplication1.exe /target:exe ObjectScopeProvider1.cs Program.cs Properties\AssemblyInfo.cs 
     
    Kompilierung abgeschlossen -- 0 Fehler, 0 Warnungen 
    ConsoleApplication1 -> C:\Daten\Test Telerik ORM\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe 
     
    c:\programme\vanatec openaccess\sdk\dotnet20\VEnhance.exe -assembly:obj\Debug\ConsoleApplication1.exe -config:C:\Daten\Test Telerik ORM\ConsoleApplication1\ConsoleApplication1\App.config -debug+ -verbose+ 
    Enhancement complete -- 0 errors, 0 warnings 
     
    OpenAccess: OpenAccessException 
    Das Objekt des Typs "Context" kann nicht in Typ "Context" umgewandelt werden. 
       bei com.versant.core.logging.LogEvent.getContext() 
       bei com.versant.core.jdo.VersantPersistenceManagerImp.setName(String value) 
    Das Objekt des Typs "Context" kann nicht in Typ "Context" umgewandelt werden. 
       bei OpenAccess.SPI.Backends.ThrowException(Exception e) 
       bei OpenAccess.RT.ExceptionWrapper.Throw() 
       bei com.versant.core.jdo.VersantPersistenceManagerImp.handleException(Throwable x) 
       bei com.versant.core.jdo.VersantPersistenceManagerImp.setName(String value) 
       bei com.versant.core.jdo.PersistenceManagerFactoryBase.configurePM(VersantPersistenceManagerImp pm) 
       bei com.versant.core.jdo.PersistenceManagerFactoryBase.getPersistenceManager() 
       bei OpenAccess.RT.DatabaseAdapter.GetObjectScope(TransactionProvider provider) 
       bei OpenAccess.RT.DatabaseAdapter.GetObjectScope() 
       bei OpenAccess.Database.GetObjectScope() 
       bei OpenAccess.Sdk.Addin.Sql.CreateDBCommands.DoesSQLServerDBExists(String databaseName, String serverName, String userId, String password, Boolean integratedSecurity, String driver, String backend, String connectionParams, CreateOrUpdateCaller createOrUpdateCaller) 
       bei OpenAccess.Sdk.Addin.Sql.CreateDBCommands.CheckForCreateOrUpdateDB(VAProject project) 
       bei VtShared.Sdk.Addin.Core.BuildEventHandler.Enhance(VAProject project, String projectConfigName, String platformName, String productName) 
    OpenAccess Error: Das Objekt des Typs "Context" kann nicht in Typ "Context" umgewandelt werden. 
     
    Create DatabaseSchema complete -- 1 errors, 0 warnings 
     
    ========== OpenAccess All: 0 succeeded, 1 failed, 1 skipped ========== 
        OpenAccess : Build Cancelled due to enhancement error(s). 
    ========== OpenAccess All: 1 succeeded, 0 failed, 0 skipped ========== 

    For an hint I would be grateful.
    Christian
  2. Answer
    Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 01 Dec 2008 Link to this post

    Hi Christian,

    That looks like there are old and new dlls loaded in one Visual Studio instance. Can you please open OpenAccess->Help->Product Info and see if you see old dlls.

    You should uninstall OpenAccess again, delete the complete directory and also the gac entries for both versions. After fresh product installation it should work.

    Regards,
    Jan Blessenohl
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft banner
Back to Top