By Sam Tenney - 11/10/2010
Something really basic is not working correctly in the StrataFrame code. When there is only 1 record in a table and that record is deleted using the Delete button on a standard Maintenance Form, an unhandled BusinessLayerException occurs.
Sam Tenney
|
By Ivan George Borges - 11/10/2010
Hi Sam.
I have just tested this situation and haven't had any error from it.
You sure there isn't any code you run on Navigated that is not checking if BO is empty?
|
By Sam Tenney - 11/10/2010
Hi Ivan,
I am running version 1.7.3.1. and I am not doing anything like you suggested. Are you maybe running a modified or newer version? This is so basic and repeatable that I am really surprised that you are not seeing the same problem I am seeing.
Sam
|
By Ivan George Borges - 11/10/2010
No Sam, I am on the same version. Tested on a simple form here and nothing wrong happened.
Would you like to create a small sample using the StrataFrame Sample database reproducing the error and attaching it over here?
|
By Ivan George Borges - 11/10/2010
Well, if you do what I asked you you will have to delete all records from Customers, for example, to be able to test it with only 1 record... maybe if you make a backup first.
|
By Sam Tenney - 11/10/2010
Ivan,
I am still very much a beginner and I am not sure I know how to make a backup first or how to post my test solution up here as you say, but I will go to work and try to learn those things and then I will get back with you.
Sam
|
By Ivan George Borges - 11/10/2010
Don't worry, we go step by step. It really looks like you have code somewhere that is making reference to the BO. It could be the Navigated, but you said you have none. Maybe the EditingStateChanged or somewhere in the BO. Have you got the stack trace? That would probably give you the clues to where you could check. Just so that you "see" it is working, I produced a small video showing the test I did here. Donwload and unzip the file attached.
Anyway, if you find it, you should add something like this:
If Me.MyBO.CurrentRowIndex < 0 Then '-- do whatever to avoid making reference to the BO, since it is empty Exit Sub EndIf
|
By Sam Tenney - 11/10/2010
Ivan,
I think I have discovered why your test works correctly and mine does not. But I think this still MAY be a bug in StrataFrame. If you determine it is not a bug, then could you explain why changing a property value causes this problem.
The MaintenanceFormToolStrip has a property named AutoManageIsDirtyChangedEvent. If that property is set to True, the exception occurs. If I set it to False, no exception occurs. After ready the description of that property I THINK I want to set it to True.
I have attached my stack trace. Notice all the pertinent code is unmodified StrataFrame code.
Sam
|
By Ivan George Borges - 11/10/2010
Well, Sam, I never said it wasn't a bug. It might be, and if so, it will be corrected.
I only happened to test here the scenario you first posted. To be honest with you, I had never touched the AutoManageIsDirtyChangedEvent, and have just had a look at it. It has been introduced on version 1.7.0.6, as we can see in the help file.
Following now with another test, I have changed the MaintenanceToolStrip AutoManageIsDirtyChangedEvent property to true, and the BO ManageUIReadOnlyState to False, as the help suggests, otherwise there won't be any effect. Again, no error.
Don't get me wrong, I do believe you are getting the error, I just have not succeeded on reproducing it. That is why a sample application could help, we would be testing the same code.
|
By Sam Tenney - 11/10/2010
Ivan,
It looks like I will need to learn how to send you my application before we will be able to resolve this issue. I will work on that.
Greg McGuffey had told me that most developers are beginning to use the automatic editing mode rather than requiring the end users to click the Edit button to begin editing a record. So I have tried to find and set all the settings required to enable automatic editing mode but apparently I had missed the ManageUIReadOnlyState property on the business object. However even after setting it to False as you did, I am still getting the unhandled exception. Is there a list available of all the settings necessary to enable automatic editing mode?
Sam
|
By Ivan George Borges - 11/10/2010
I changed only these two and it worked as advertised.
Have you tried adding a breakpoint into the BO BeforeDelete event and debug what goes on? You can also step into the framework and follow the action.
If you decide to create a sample application, just create a new application with a simple form that will reproduce the error. Once you get that done, zip the solution folder up and use the "Attach Files" link to upload it into your post.
|
By Sam Tenney - 11/11/2010
Ivan,
In the attached zip file you will find a folder named "SQL Data Folder" which contains my test database which you can ATTACH to your SQL server. The database is named "Telonics Test Database" and the table is named "TestTable". The solution is very basic but it does show the exception I am seeing when I run it. There is only one record in the table. Just try deleting it and with any luck you should see the same exception that I see.
I hope I followed your instructions correctly on how to zip up my solution etc.
I appreciate the patience you have shown with me and the time you have spent trying to help.
Sam Tenney
Telonics, Inc.
|
By Ivan George Borges - 11/11/2010
Hi Sam.
Thanks for the sample. I am sending you the video of my test, and you will find this strange, but it worked flawlessly here. I really wish I got the same error, so we could try and find a fix for it. There is something else going on... what SQL Server are you using, although I don't think there could be something with it. You say you are under SF 1.7.3.1, but could you please check if you don't have old SF DLLs somewhere else? If you do, get rid of them so Visual Studio won't find the wrong ones. Another test you could do would be to create a new Virtual Machine or even another computer and try on this different environment, just to check.
I have attached the test for you to have a look. If there is any other step you would like me to do with your sample, let me know and I will test over here again.
|
By Sam Tenney - 11/12/2010
Hi Ivan,
I am using SQL 2008 Express, but I agree with you that I don't think there could be a problem there. In Visual Studio when I click on the StrataFrame / Version menu option, all the assemblies show version 1.7.3.1. Where else can I look for old DLL's?
Sam Tenney
Telonics, Inc.
|
By Ivan George Borges - 11/12/2010
Try using Windows Explorer and searching from your C:\ by "MicroFour StrataFrame Business.dll"
Were you able to test it on a different environment?
|
By Sam Tenney - 11/12/2010
Hi Ivan,
Good News! By trial and error I have found what seems to be causing the problem. I am using Visual Studio 2008 and I like to step thru the SF framework code. When I downloaded and ran the source code file and tried to build the various SF solutions to create the necessary *.PDB files, I was getting build errors.
On 9/4/2010 in post #28428 on this forum you provided instructions on how to modify the SF solution and project files with Notepad to allow Visual Studio 2008 to build correctly. I followed those instructions and was successful in building the SF solutions. Since then I have been able to step thru the framework source code with no apparent problems. So I think the SF DLL files I am actually using are from the source code I downloaded and modified per your instructions. I think I am not actually using the "normal" SF installation DLL files. Both the source code file and the installation file that I downloaded were originally dated 8/31/2010.
As a test today I renamed the source code folder so that I would not be using those DLL files. I ran my sample application and did not receive an exception. I then downloaded the source code file fresh and ran it. I then carefully modified the solution and project files per your instructions and then built the solutions. I ran my sample application again and the exception returned.
I have no idea why this is happening, I just know it is happening. I'm sure you can figure out why.
Sam Tenney
|
By Ivan George Borges - 11/12/2010
Well, I will stick to the "good news" part of it all.
Good to know you found a possible issue. Guess you will be fine, since you won't distribute the DLLs in a debug mode, so the users won't face the issue. I will get this on the list to have a look in a near future and see if we can think of what might be. The strange part is that I am also running the DLLs on debug mode, so I compiled the source code too.
Anyway, glad you got it going.
|
By Sam Tenney - 11/13/2010
Hi Ivan,
Remember, I am running Visual Studio 2008 not 2010 and I made the changes to the solution and project files that you instructed me to do. Could those be the differences between my DLL's and yours?
Sam Tenney
|
By Ivan George Borges - 11/14/2010
I am not sure. I haven't got any machine with VS2008 installed anymore, so I am not able to test this scenario at the moment. Have you tried putting a break point in the BeforeDelete and step through the source code to check it?
|