SonyWWS / ATF

Authoring Tools Framework (ATF) is a set of C#/.NET components for making tools on Windows. ATF has been in continuous development in Sony Computer Entertainment's (SCE) Worldwide Studios central tools group since early 2005. ATF has been used by most SCE first party studios to make many custom tools such as Naughty Dog’s level editor and shader editor for The Last of Us, Guerrilla Games’ sequence editor for Killzone games (including the Killzone: Shadow Fall PS4 launch title), an animation blending tool at Santa Monica Studio, a level editor at Bend Studio, a visual state machine editor for Quantic Dream, sound editing tools, and many others.
Apache License 2.0
1.89k stars 262 forks source link

How to use SharpDX in main project #32

Closed BennyKJohnson closed 8 years ago

BennyKJohnson commented 9 years ago

Hi, ATF is great. However for my current project I need access to the SharpDX libraries. When I add a reference to SharpDX in an ATF project I receive the error "System.TypeInitializationException". If I'm not mistaken I believe this issue is the result of SharpDX already being used in the ATF framework.

I was wondering if anyone knew how to resolve this issue or other method to get access to the SharpDX libraries within the main project.

Full Error: An exception of type 'System.TypeInitializationException' occurred in Atf.Gui.WinForms.dll but was not handled in user code Additional information: The type initializer for 'Sce.Atf.Resources' threw an exception.

Thanks

Ron2 commented 9 years ago

Hello,

I added every SharpDX library that is included with ATF to the Circuit Editor sample app, and I'm not getting that exception. It's legal and normal to reference the same dll from multiple projects.

Do you have the setting "break when an exception is thrown" set for all exceptions? This is in Debug -> Exceptions. I'm wondering if you have accidentally defined a method named ResourceUtil.Register(Type). That static Resources class uses reflection to search for that method, but it will throw an exception if it finds two of them. You would see an InvalidOperationException being raised in this case, but if you don't have break-on-exceptions turned on, you might just see the TypeInitializationException thrown afterwards, whose InnerException property is the original InvalidOperationException.

If that's not it, maybe you could set a breakpoint in Sce.Atf.Resources, in the static constructor, and see how far execution gets (if at all).

Please let me know how it goes and if you can report more info.

--Ron

kiwidoggie commented 7 years ago

I am also getting the same error, by including the SharpDX 3.1.1 library without any references (in code) to it.

System.ComponentModel.Composition Warning: 1 : The ComposablePartDefinition 'Sce.Atf.Applications.StandardEditCommands' has been rejected. The composition remains unchanged. The changes were rejected because of the following error(s): The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.

1) No exports were found that match the constraint: ContractName Sce.Atf.Applications.IContextRegistry RequiredTypeIdentity Sce.Atf.Applications.IContextRegistry

Resulting in: Cannot set import 'Sce.Atf.Applications.StandardEditCommands..ctor (Parameter="contextRegistry", ContractName="Sce.Atf.Applications.IContextRegistry")' on part 'Sce.Atf.Applications.StandardEditCommands'. Element: Sce.Atf.Applications.StandardEditCommands..ctor (Parameter="contextRegistry", ContractName="Sce.Atf.Applications.IContextRegistry") --> Sce.Atf.Applications.StandardEditCommands --> TypeCatalog (Types='Sce.Atf.Applications.SettingsService, Sce.Atf.Applications.StatusService, ...').

System.ComponentModel.Composition Warning: 1 : The ComposablePartDefinition 'Sce.Atf.Applications.StandardEditHistoryCommands' has been rejected. The composition remains unchanged. The changes were rejected because of the following error(s): The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.

1) No exports were found that match the constraint: ContractName Sce.Atf.Applications.IContextRegistry RequiredTypeIdentity Sce.Atf.Applications.IContextRegistry

Resulting in: Cannot set import 'Sce.Atf.Applications.StandardEditHistoryCommands..ctor (Parameter="contextRegistry", ContractName="Sce.Atf.Applications.IContextRegistry")' on part 'Sce.Atf.Applications.StandardEditHistoryCommands'. Element: Sce.Atf.Applications.StandardEditHistoryCommands..ctor (Parameter="contextRegistry", ContractName="Sce.Atf.Applications.IContextRegistry") --> Sce.Atf.Applications.StandardEditHistoryCommands --> TypeCatalog (Types='Sce.Atf.Applications.SettingsService, Sce.Atf.Applications.StatusService, ...').

System.ComponentModel.Composition Warning: 1 : The ComposablePartDefinition 'Sce.Atf.Applications.StandardSelectionCommands' has been rejected. The composition remains unchanged. The changes were rejected because of the following error(s): The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.

1) No exports were found that match the constraint: ContractName Sce.Atf.Applications.IContextRegistry RequiredTypeIdentity Sce.Atf.Applications.IContextRegistry

Resulting in: Cannot set import 'Sce.Atf.Applications.StandardSelectionCommands..ctor (Parameter="contextRegistry", ContractName="Sce.Atf.Applications.IContextRegistry")' on part 'Sce.Atf.Applications.StandardSelectionCommands'. Element: Sce.Atf.Applications.StandardSelectionCommands..ctor (Parameter="contextRegistry", ContractName="Sce.Atf.Applications.IContextRegistry") --> Sce.Atf.Applications.StandardSelectionCommands --> TypeCatalog (Types='Sce.Atf.Applications.SettingsService, Sce.Atf.Applications.StatusService, ...').

I was wondering if there was any resolution to this? Throws on Atf.Core.vs2010/ATF/Framework/ATF.Core/MefUtil.cs line 60.

abeckus commented 7 years ago

Hi, Currently ATF is in maintenance mode, no more work will be done expect major bug fixes.

Thanks Alan