3 Replies Latest reply: Oct 27, 2011 8:29 AM by 730216 RSS

    Problems with new Beta 3

    730216
      When I try to create a model from the database, I get this:

      An exception of type "System.TypeInitializationException" occurred while attempting to launch Entity Data Model Wizard.
      The exception message is:
      Type constructor threw an exception.


      I've tried adding a new Data Source, adding a new empty Entity Data Model to the project, and adding a new Data Model generated from the database. All result in the same error.
        • 1. Re: Problems with new Beta 3
          Christian.Shay -Oracle
          Can you narrow this down? Does it happen with a fresh project and a simple table?

          Thanks,
          Christian
          • 2. Re: Problems with new Beta 3
            Christian.Shay -Oracle
            Also, if you are getting this error with a simple testcase and if you never had this working with previous versions please watch out for 64 bit vs 32 bit issues:

            1) Don't target your application for "AnyCPU". Choose 64-bit or 32-bit depending on which beta ODAC you installed. They must match.
            2) Use the Oracle installer to install ODAC if you are having problems with Xcopy.
            • 3. Re: Problems with new Beta 3
              730216
              Thanks for the tips.

              I'm working with a new Class Library project. I tried switching it to target x86 instead of AnyCPU but got the same error. I used the Oracle installer to install Beta 3.

              The table I'm trying to model is a very simple test table that I created. Here's the script:

              CREATE TABLE PERSON
              (
              ID INTEGER,
              FIRST_NAME VARCHAR2(30 BYTE) NOT NULL,
              LAST_NAME VARCHAR2(30 BYTE) NOT NULL
              )
              TABLESPACE DEFAULT_USER
              PCTUSED 40
              PCTFREE 10
              INITRANS 1
              MAXTRANS 255
              STORAGE (
              INITIAL 64K
              MINEXTENTS 1
              MAXEXTENTS UNLIMITED
              PCTINCREASE 0
              FREELISTS 1
              FREELIST GROUPS 1
              BUFFER_POOL DEFAULT
              )
              LOGGING
              NOCOMPRESS
              NOCACHE
              NOPARALLEL
              MONITORING;


              CREATE UNIQUE INDEX PERSON_PK ON PERSON
              (ID)
              LOGGING
              TABLESPACE DEFAULT_USER
              PCTFREE 10
              INITRANS 2
              MAXTRANS 255
              STORAGE (
              INITIAL 64K
              MINEXTENTS 1
              MAXEXTENTS UNLIMITED
              PCTINCREASE 0
              FREELISTS 1
              FREELIST GROUPS 1
              BUFFER_POOL DEFAULT
              )
              NOPARALLEL;

              CREATE OR REPLACE TRIGGER PERSON_TRG
              BEFORE INSERT
              ON PERSON
              REFERENCING NEW AS New OLD AS Old
              FOR EACH ROW
              DECLARE
              N NUMBER;
              BEGIN
              -- For Toad: Highlight column ID
              SELECT PERSON_SEQ.NEXTVAL INTO n FROM DUAL;

              :new.ID := N;
              END PERSON_TRG;
              /

              ALTER TABLE PERSON ADD (
              CONSTRAINT PERSON_PK
              PRIMARY KEY
              (ID)
              USING INDEX PERSON_PK
              ENABLE VALIDATE);


              It lets me go through the wizard, choosing a connection, then the table, but once I click Finish, I get the "Type constructor threw an exception" error.

              The edmx file looks like it's created correctly if I view the XML, but the designer fails to load with "The operation could not be completed". It has the SSDL, CSDL, C-S mapping, and EF Designer sections.

              The output generated is:
              Generated model file: Model1.edmx.
              Loading metadata from the database took 00:00:06.6309154.
              Generating the model took 00:00:09.6584683.
              Added the connection string to the App.Config file.
              Writing the .edmx file took 00:00:00.0017806.



              My machine is running VS2010 SP1 on Windows XP SP3.


              edit - I tried generating a model from SQL Server Express and had the same error, so it's probably not related to ODP.NET.