InvalidCastException


Author
Message
Larry Caylor
Larry Caylor
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
I've set up a new Windows 10 system. On this system I have both VS2013 & VS2015.  I've installed the new AddIns.dll and Extensibility.dll from the VSPackage posted on the forum and run the vsix package to install StratafFrame V1 for VS2013 & 2015. I've also disabled the StrataFrame Add In for VS2013.  After opening an existing VS2013 project everything looks fine until I try to modify the PopulationDataSourceSettings on an Infragistics listview.  When I click on the PopulationDataSourceSettings, I get the following exception. Just to make sure the error is not related to the Infragistics wrapper I tried a SF Listview and go the same exception. (I'd post the actual screen capture but the forum web page tells me I've exceeded my file upload limit).

InvalidCastException
  Unable to cast object of type 'Microsoft.VisualStudio.Design.VSDynamicTypeService' to type 'Microsoft.VisualStudio.Shell.Design.DynamicTypeService'.
Source     : MicroFour StrataFrame Extensibility
Stack Trace:
   at MicroFour.StrataFrame.Extensibility.ExtensibilityBasics.GetDynamicTypeService()
   at MicroFour.StrataFrame.Extensibility.ExtensibilityBasics.get_CurrentDynamicTypeService()
   at MicroFour.StrataFrame.Extensibility.ExtensibilityBasics.GetTypeDiscoveryService(Project Project)
   at MicroFour.StrataFrame.Extensibility.ExtensibilityBasics.get_CurrentITypeDiscoveryService(Project Project)
   at MicroFour.StrataFrame.Extensibility.ExtensibilityBasics.GetAvailableClasses(Type BaseType, IServiceProvider Provider, Boolean IncludeReferences)
   at MicroFour.StrataFrame.Extensibility.ExtensibilityBasics.GetAvailableClassesNames(Type BaseType, IServiceProvider Provider, Boolean IncludeReferences, Boolean ReturnFullNames)
   at MicroFour.StrataFrame.Extensibility.ListViewPopulationEditorDialog.PopulateBusinessObjects()
   at MicroFour.StrataFrame.Extensibility.ListViewPopulationEditorDialog.tmStart_Tick(Object sender, EventArgs e)

So I decided I'd try opening the project in VS2015. In VS2015 I'm able to open and modify the PopulationDataSourceSettings but when I try to open the Object Mapper I get the following exception.

COMException
  Error HRESULT E_FAIL has been returned from a call to a COM component.
Source     : EnvDTE
Stack Trace:
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at Microsoft.VisualStudio.LanguageServices.Implementation.Utilities.Exceptions.ThrowEFail()
   at Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.ExternalElements.AbstractExternalCodeElement.LookupSymbol()
   at Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.ExternalElements.AbstractExternalCodeElement.GetName()
   at Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.ExternalElements.AbstractExternalCodeElement.get_Name()
   at EnvDTE.CodeElement.get_Name()
   at MicroFour.StrataFrame.Extensibility.ExtensibilityBasics.ParseClass(CodeElement Element, Project ContainingProject, String MatchingBaseType, Boolean ParseNestedTypes)
   at MicroFour.StrataFrame.Extensibility.ExtensibilityBasics.GetAvailableClasses(Project Prj, Boolean IncludeReferences, Boolean IsWebProject, String BaseClassName, Boolean ParseNestedTypes)
   at MicroFour.StrataFrame.Extensibility.ExtensibilityBasics.GetAvailableBusinessObjects(Project Prj, Boolean IncludeReferences, Boolean IsWebProject)
   at MicroFour.StrataFrame.AddIns.PartialClassBuilderDialog.CompileProjectItemCollection()

The object mapper works fine in VS2013.


I did have SF V2 installed on the system but I uninstalled if from both VS2013 & Vs2015 but that didn't make any difference.

-Larry











Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Larry,

I have a new computer and tomorrow will be installing StrataFrame, so I would have a better recollection on that configuration.

In the meantime, couple of things to review:
  1. Make sure that the connection to the StrataFrame.mdb database is configured for StrataFrame.
  2. Make sure you follow the directions on installing the .VSX package, and manually registering the required assemblies using the VS command prompt as "Administrator".
  3. StrataFrame v2 has nothing to do with SFv1, so not need to worry about it.  It is a complete separate assemblies and namespaces, so they can both co-exist beautifully.
Good luck, if you don't make it work by tomorrow, I will be configuring mine and will have better suggestions.

Edhy Rijo

StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The first one is because we are trying to cast to the specific type instead of using the root interface that they both implement.  I don't know that I ever tested the new package on VS2013.  I can change that to the interface and recompile it.  I just have to figure out what obscure VSShell assembly contains ITypeResolutionServiceProvider.

The second one is interesting.  There isn't anything on the CodeElement that will allow us to determine whether it has a name, so I'm going to wrap that in a Try/Catch and just ignore the element if it throws an exception.
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
I swapped out the VISX with the fixes on the Posted Releases thread, Larry.

Give it a try and let me know.  Thanks.
Larry Caylor
Larry Caylor
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
 
Ben and Edhy, thanks for the quick reply. I've got VS2015 working. I created a simple solution with one BO and everything worked so I figured it had to be something with my VS2013 solution. It has 10 projects and after a little troubleshooting I isolated the source of the error to one project. In that project I use SyncFusion's File Formats product to programmatically create Excel files. Deleting the reference to the SyncFusion dll's and re-referencing them fixed the BO mapper problemSmile No sure as to why that worked as the project appeared to compile correctly under VS2015 so I'm assuming the reference was ok. I also re-installed SF v2.

I'm using the SyncFusion product because the SF ExcelHelper tool didn't do exactly what I wanted. The SyncFusion product was just under $1,000 and also incudes tools for PDF, Word and PowerPoint files. I also considered GrapeCity's Spread for Windows, which looks like a really nice product but is more expensive and has more features than I need, including visual components.

Does the new visx fix the VS2013 problem or does it just ignore the code element in BO mapper? If it doesn't address the VS2013 problem then there is no hurry from me to fix it as I can now move everything to VS2015.

-Larry
Larry Caylor
Larry Caylor
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
Hi Ben,

I spoke too soon. It seems that some SyncFusion dll's cause problems some do not so I gave the new SF dll's a try. I uninstalled the extension from VS2013 & 2015, added the new dll's to the GAC and re-ran the visx package and now Object  Mapper is grayed out in the SF menu.

-Larry



Larry Caylor
Larry Caylor
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
Hi Ben,

I've been looking at this for too longCrazy I cleared out the dll's, uninstalled the visx packages and re-installed everything again and all is well now. The new package ignores whatever it is in the Syncfusion.XlsIO.ClinetProfie dll that was creating a problem for BO mapper and PopulationDataSourceSettings for list views in VS2013 now works.

-Larry
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Larry Caylor (2/28/2017)
 
Does the new visx fix the VS2013 problem or does it just ignore the code element in BO mapper? If it doesn't address the VS2013 problem then there is no hurry from me to fix it as I can now move everything to VS2015. -Larry


Hi Larry,
Since VS2015 supports any .Net runtime, I would suggest you move your solution to VS2015.  Also, keep in mind that VS2017 will be released next week on March 7.

Edhy Rijo

Edited 7 Years Ago by Edhy Rijo
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
I'm glad that got you fixed.  

VisualStudio changed their shell implementation of ITypeResolutionServiceProvider from Microsoft.VisualStudio.Design.VSDynamicTypeService to Microsoft.VisualStudio.Shell.Design.DynamicTypeService.  I can't find the assembly where the ITypeResolutionServiceProvider is actually defined, and the both service objects are _COMObjects, so I changed the internal type to Object and used Type.InvokeMember() on the object to get the services I needed from the provider.  As for why the SyncFusion Assemblies would cause that error to occur, I'm guessing that they use the same provider and somehow get it to initialize differently than us, so if they initialize the provider first it was the type we weren't expecting.

I'm glad to hear about the SyncFunction PDF components.  Trent's been working with one of their salespeople for a while on acquiring that for us for use in our upcoming document manager for our medial software.  A PDF component is not something we want to write.
Larry Caylor
Larry Caylor
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
Edhy,

I'm sure you'll be one of the first on VS2017, but I think I'll stay with VS2015 for a few months.

-Larry
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search