Error with design-time drag-and-drop of collection

Posts   
 
    
mattmerk
User
Posts: 8
Joined: 11-Jan-2005
# Posted on: 11-Jan-2005 02:35:24   

Hello

I followed the design-time instructions in the help documentation and kept running into an error message within visual studio. The error happened when I attempted to drag a collection from the ToolBox onto a WebForm. The message stated "The operation could not be completed" (Microsoft Development Environment popup).

I had originally posted here asking for help, but after giving up... and then trying again later.. it spontaneously worked.

Not sure if i happened upon an obscure bug, so I just thought I would go ahead and post about it. Most likely it was just a hiccup on my machine..?

Matt

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 11-Jan-2005 09:35:27   

VS.NET is not very helpful with the error messages it gives in this area. The cause of the error you're experiencing can be anything, unfortunately. During the tests I did I didn't run into any issues so I'm not sure in which way to look for a possible cause of this. You use selfservicing?

Frans Bouma | Lead developer LLBLGen Pro
mattmerk
User
Posts: 8
Joined: 11-Jan-2005
# Posted on: 11-Jan-2005 16:33:56   

Yes, I am using self-servicing.

Here is an idea of what I did:

  1. I downloaded and installed the latest LLBLGen after uninstalling the previous version.

  2. I opened, and regenerated the code for an existing LLBLGen project. (self servicing)

  3. I added the collections to the toolbar successfully.

  4. Created a NEW WebForm.

  5. Attempted to drag a collection to the webform and received the error message.

Like I said before... It works now, so I am happy! I also must say that I really love LLBLGen. I have tried many other products and this one proved to be the best.

Thanks Matt

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 11-Jan-2005 17:07:39   

mattmerk wrote:

Yes, I am using self-servicing.

Here is an idea of what I did:

  1. I downloaded and installed the latest LLBLGen after uninstalling the previous version.

  2. I opened, and regenerated the code for an existing LLBLGen project. (self servicing)

  3. I added the collections to the toolbar successfully.

  4. Created a NEW WebForm.

  5. Attempted to drag a collection to the webform and received the error message.

Like I said before... It works now, so I am happy!

It can be that there was still an old compiled site version in the bin folder. I had a similar strange error with a drag-n-drop of a collection onto an existing webform which gave me "Invalid pointer" as the error message (which is not my error message, but vs.net's but who knows what it means)... After removing everything from teh bin folder it worked. Oh well.. simple_smile

I also must say that I really love LLBLGen. I have tried many other products and this one proved to be the best.

Thanks! smile

Frans Bouma | Lead developer LLBLGen Pro
mattmerk
User
Posts: 8
Joined: 11-Jan-2005
# Posted on: 14-Feb-2005 18:18:57   

Hi Otis

After having resolved the above issue, I have run into another.

I am able to drag the collection onto a webform, and I am also able to bind controls, etc. All seems to be working fine for a while.... However, when I come back to the page later within visual studio, the designer loses the collection that I had placed on the page.

Have you seen this before? One thing that I am doing that is "non-standard" is that I am using Master Pages from WilsonDotNet.

Thanks for your help Matt

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 14-Feb-2005 18:35:32   

I haven't seen that before, but it could still be related to the old code i.e.: the collection factory is serialized into the resx file instead of the newer code which simply emits an instantiation call to the factory.

Do you get an error in the output / taskpane of vs.net ?

Frans Bouma | Lead developer LLBLGen Pro
mattmerk
User
Posts: 8
Joined: 11-Jan-2005
# Posted on: 14-Feb-2005 20:03:35   

Otis wrote:

Do you get an error in the output / taskpane of vs.net ?

Task error says: Could not find type 'MyApp1.LLBLGen.CollectionClasses.DocumentCollection'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 14-Feb-2005 20:37:25   

I think you still use the old code. In your form initialization code, does the code there deserialize the factory class or does it simply create a new factory instance?

Also, do you have a reference to the generated code in your project?

Frans Bouma | Lead developer LLBLGen Pro
mattmerk
User
Posts: 8
Joined: 11-Jan-2005
# Posted on: 14-Feb-2005 21:10:03   

Otis wrote:

I think you still use the old code.

What do you mean by 'old code'?

Otis wrote:

In your form initialization code, does the code there deserialize the factory class or does it simply create a new factory instance?

In my webform .cs, under IntializeComponent I have


System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Documents));
this.documentCollection1 = new MyApp1.LLBLGen.CollectionClasses.DocumentCollection();
// 
// mediaDocumentCollection1
//
// etc... fills my properties for the collection..

Otis wrote:

Also, do you have a reference to the generated code in your project?

I have a PROJECT reference for my LLBLGen project.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 14-Feb-2005 22:09:37   

mattmerk wrote:

Otis wrote:

I think you still use the old code.

What do you mean by 'old code'?

After design time databinding was added, the code was changed so the form initialization code was more flexible.

Otis wrote:

In your form initialization code, does the code there deserialize the factory class or does it simply create a new factory instance?

In my webform .cs, under IntializeComponent I have


System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Documents));
this.documentCollection1 = new MyApp1.LLBLGen.CollectionClasses.DocumentCollection();
// 
// mediaDocumentCollection1
//
// etc... fills my properties for the collection..

The fills my properties for teh collection part is important. Could you paste that please?

Otis wrote:

Also, do you have a reference to the generated code in your project?

I have a PROJECT reference for my LLBLGen project.

Ok. The collection is however part of the compiled form of that project. Is that compiled form available or is that deleted?

Frans Bouma | Lead developer LLBLGen Pro
mattmerk
User
Posts: 8
Joined: 11-Jan-2005
# Posted on: 14-Feb-2005 22:36:50   

The fills my properties for teh collection part is important. Could you paste that please?

 private void InitializeComponent()
        {   
            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(PastCoverage));
            this.mediaDocumentCollection2 = new MyApp1.LLBLGen.CollectionClasses.MediaDocumentCollection();
            // 
            // mediaDocumentCollection2
            // 
            this.mediaDocumentCollection2.AllowEdit = true;
            this.mediaDocumentCollection2.AllowNew = true;
            this.mediaDocumentCollection2.AllowRemove = false;
            this.mediaDocumentCollection2.EntityFactoryToUse = ((SD.LLBLGen.Pro.ORMSupportClasses.IEntityFactory)(resources.GetObject("mediaDocumentCollection2.EntityFactoryToUse")));
            this.mediaDocumentCollection2.MaxNumberOfItemsToReturn = ((long)(0));
            this.mediaDocumentCollection2.SortClauses = null;
            this.mediaDocumentCollection2.SupportsSorting = false;
            this.mediaDocumentCollection2.SuppressClearInGetMulti = false;
            this.mediaDocumentCollection2.Transaction = null;
            this.mediaDocumentCollection2.ValidatorToUse = null;
            this.Load += new System.EventHandler(this.Page_Load);

        }

Ok. The collection is however part of the compiled form of that project. Is that compiled form available or is that deleted?

I had added the collections to the VS toolbar by selecting the DLL generated in the LLBLGen project (/bin/debug/ProjectX.LLBLGen.dll)... which still exists.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 15-Feb-2005 09:26:03   

mattmerk wrote:

The fills my properties for teh collection part is important. Could you paste that please?

 private void InitializeComponent()
        {   
            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(PastCoverage));
            this.mediaDocumentCollection2 = new MyApp1.LLBLGen.CollectionClasses.MediaDocumentCollection();
            // 
            // mediaDocumentCollection2
            // 
            this.mediaDocumentCollection2.AllowEdit = true;
            this.mediaDocumentCollection2.AllowNew = true;
            this.mediaDocumentCollection2.AllowRemove = false;
            this.mediaDocumentCollection2.EntityFactoryToUse = ((SD.LLBLGen.Pro.ORMSupportClasses.IEntityFactory)(resources.GetObject("mediaDocumentCollection2.EntityFactoryToUse")));

As you can see, old code. It should state: this.mediaDocumentCollection2.EntityFactoryToUse = new MediaDocumentEntityFactory();

Please upgrade to the latest runtime libraries.

Frans Bouma | Lead developer LLBLGen Pro