├── .config
├── 1espt
│ └── PipelineAutobaseliningConfig.yml
└── tsaoptions.json
├── .gdn
├── .gdnsettings
└── .gitignore
├── .gitattributes
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.yml
│ └── config.yml
├── actions
│ ├── setup-llvm-mingw
│ │ └── action.yml
│ └── setup-llvm-msvc
│ │ └── action.yml
├── dependabot.yml
├── pull_request_template.md
└── workflows
│ ├── ci.yml
│ └── stale.yml
├── .gitignore
├── .pipelines
├── OneBranch.Official.yml
├── OneBranch.PullRequest.yml
├── build.yml
├── jobs
│ ├── OneBranchBuild.yml
│ ├── OneBranchNuGet.yml
│ ├── OneBranchTest.yml
│ └── OneBranchVsix.yml
├── sync-mirror.yml
└── variables
│ ├── OneBranchVariables.yml
│ └── version.yml
├── CMakeLists.txt
├── Directory.Build.Props
├── Directory.Packages.props
├── LICENSE
├── README.md
├── build_nuget.cmd
├── build_prior_projection.cmd
├── build_projection.cmd
├── build_test_all.cmd
├── build_vsix.cmd
├── compile_tests.cmd
├── cppwinrt.sln
├── cppwinrt
├── app.manifest
├── cmd_reader.h
├── code_writers.h
├── component_writers.h
├── cppwinrt.vcxproj
├── cppwinrt.vcxproj.filters
├── file_writers.h
├── helpers.h
├── main.cpp
├── packages.config
├── pch.cpp
├── pch.h
├── settings.h
├── task_group.h
├── text_writer.h
└── type_writers.h
├── cross-mingw-toolchain.cmake
├── docs
├── code_of_conduct.md
├── contributing.md
└── security.md
├── fast_fwd
├── arm64
│ └── thunks.asm
├── fast_fwd.vcxproj
├── thunks.inc
├── win32
│ └── thunks.asm
└── x64
│ └── thunks.asm
├── mingw-support
├── xmllite.def
└── xmllite_i386.def
├── natvis
├── SignConfig.xml
├── cppwinrt.natvis
├── cppwinrt_visualizer.cpp
├── cppwinrt_visualizer.h
├── cppwinrtvisualizer.def
├── cppwinrtvisualizer.sln
├── cppwinrtvisualizer.vcxproj
├── cppwinrtvisualizer.vsdconfigxml
├── cppwinrtvisualizer15.vsdconfigxml
├── dllmain.cpp
├── object_visualizer.cpp
├── object_visualizer.h
├── packages.config
├── pch.cpp
├── pch.h
├── property_visualizer.cpp
├── property_visualizer.h
└── type_resolver.cpp
├── nuget.config
├── nuget
├── CppWinrtRules.Project.xml
├── Microsoft.Windows.CppWinRT.nuspec
├── Microsoft.Windows.CppWinRT.props
├── Microsoft.Windows.CppWinRT.targets
├── SignConfig.xml
├── readme.md
└── readme.txt
├── prebuild
├── CMakeLists.txt
├── main.cpp
├── pch.cpp
├── pch.h
└── prebuild.vcxproj
├── prepare_versionless_diffs.cmd
├── run_tests.cmd
├── scratch
├── main.cpp
├── pch.cpp
├── pch.h
└── scratch.vcxproj
├── strings
├── base_abi.h
├── base_activation.h
├── base_agile_ref.h
├── base_array.h
├── base_chrono.h
├── base_collections.h
├── base_collections_base.h
├── base_collections_input_iterable.h
├── base_collections_input_map.h
├── base_collections_input_map_view.h
├── base_collections_input_vector.h
├── base_collections_input_vector_view.h
├── base_collections_map.h
├── base_collections_vector.h
├── base_com_ptr.h
├── base_composable.h
├── base_coroutine_foundation.h
├── base_coroutine_system.h
├── base_coroutine_system_winui.h
├── base_coroutine_threadpool.h
├── base_coroutine_ui_core.h
├── base_deferral.h
├── base_delegate.h
├── base_error.h
├── base_events.h
├── base_extern.h
├── base_fast_forward.h
├── base_foundation.h
├── base_handle.h
├── base_identity.h
├── base_implements.h
├── base_includes.h
├── base_iterator.h
├── base_lock.h
├── base_macros.h
├── base_marshaler.h
├── base_meta.h
├── base_natvis.h
├── base_reference_produce.h
├── base_reference_produce_1.h
├── base_security.h
├── base_std_hash.h
├── base_string.h
├── base_string_input.h
├── base_string_operators.h
├── base_stringable_format.h
├── base_stringable_format_1.h
├── base_stringable_streams.h
├── base_stringable_to_hstring.h
├── base_types.h
├── base_version.h
├── base_version_odr.h
├── base_weak_ref.h
├── base_windows.h
├── base_xaml_component_connector.h
├── base_xaml_component_connector_winui.h
└── base_xaml_typename.h
├── test
├── CMakeLists.txt
├── catch.hpp
├── mingw_com_support.h
├── nuget
│ ├── ConsoleApplication1
│ │ ├── ConsoleApplication1.vcxproj
│ │ ├── ConsoleApplication1.vcxproj.filters
│ │ ├── ConsoleApplication1Class.cpp
│ │ ├── ConsoleApplication1Class.h
│ │ ├── ConsoleApplication1Class.idl
│ │ ├── PropertySheet.props
│ │ ├── main.cpp
│ │ ├── pch.cpp
│ │ ├── pch.h
│ │ └── readme.txt
│ ├── Directory.Build.props
│ ├── Directory.Build.targets
│ ├── NuGetTest.sln
│ ├── TestApp
│ │ ├── App.cpp
│ │ ├── App.h
│ │ ├── App.idl
│ │ ├── App.xaml
│ │ ├── Assets
│ │ │ ├── LockScreenLogo.scale-200.png
│ │ │ ├── SplashScreen.scale-200.png
│ │ │ ├── Square150x150Logo.scale-200.png
│ │ │ ├── Square44x44Logo.scale-200.png
│ │ │ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ │ │ ├── StoreLogo.png
│ │ │ └── Wide310x150Logo.scale-200.png
│ │ ├── MainPage.cpp
│ │ ├── MainPage.h
│ │ ├── MainPage.idl
│ │ ├── MainPage.xaml
│ │ ├── Package.appxmanifest
│ │ ├── PropertySheet.props
│ │ ├── TestApp.vcxproj
│ │ ├── TestApp.vcxproj.filters
│ │ ├── pch.cpp
│ │ ├── pch.h
│ │ └── readme.txt
│ ├── TestProxyStub
│ │ ├── IAsyncContract.idl
│ │ ├── IAsyncContractParameter.idl
│ │ ├── TestProxyStub.def
│ │ ├── TestProxyStub.vcxproj
│ │ ├── pch.cpp
│ │ └── pch.h
│ ├── TestRuntimeComponent1
│ │ ├── PropertySheet.props
│ │ ├── TestRuntimeComponent1.def
│ │ ├── TestRuntimeComponent1.vcxproj
│ │ ├── TestRuntimeComponent1.vcxproj.filters
│ │ ├── TestRuntimeComponent1Class.cpp
│ │ ├── TestRuntimeComponent1Class.h
│ │ ├── TestRuntimeComponent1Class.idl
│ │ ├── pch.cpp
│ │ ├── pch.h
│ │ └── readme.txt
│ ├── TestRuntimeComponent2
│ │ ├── PropertySheet.props
│ │ ├── TestRuntimeComponent2.def
│ │ ├── TestRuntimeComponent2.vcxproj
│ │ ├── TestRuntimeComponent2.vcxproj.filters
│ │ ├── TestRuntimeComponent2Class.cpp
│ │ ├── TestRuntimeComponent2Class.h
│ │ ├── TestRuntimeComponent2Class.idl
│ │ ├── module.cpp
│ │ ├── pch.cpp
│ │ ├── pch.h
│ │ └── readme.txt
│ ├── TestRuntimeComponent3
│ │ ├── PropertySheet.props
│ │ ├── TestRuntimeComponent3.def
│ │ ├── TestRuntimeComponent3.vcxproj
│ │ ├── TestRuntimeComponent3.vcxproj.filters
│ │ ├── TestRuntimeComponent3Class.cpp
│ │ ├── TestRuntimeComponent3Class.h
│ │ ├── TestRuntimeComponent3Class.idl
│ │ ├── module.cpp
│ │ ├── pch.cpp
│ │ ├── pch.h
│ │ └── readme.txt
│ ├── TestRuntimeComponentCSharp
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── TestRuntimeComponentCSharp.csproj
│ │ └── TestRuntimeComponentCSharpClass.cs
│ ├── TestRuntimeComponentCX
│ │ ├── TestRuntimeComponentCX.vcxproj
│ │ ├── TestRuntimeComponentCX.vcxproj.filters
│ │ ├── TestRuntimeComponentCXClass.cpp
│ │ ├── TestRuntimeComponentCXClass.h
│ │ ├── pch.cpp
│ │ └── pch.h
│ ├── TestRuntimeComponentCXReferencingWinRTStaticLibrary
│ │ ├── CxClass.cpp
│ │ ├── CxClass.h
│ │ ├── TestRuntimeComponentCXReferencingWinRTStaticLibrary.vcxproj
│ │ ├── TestRuntimeComponentCXReferencingWinRTStaticLibrary.vcxproj.filters
│ │ ├── pch.cpp
│ │ └── pch.h
│ ├── TestRuntimeComponentEmpty
│ │ ├── PropertySheet.props
│ │ ├── TestRuntimeComponentEmpty.def
│ │ ├── TestRuntimeComponentEmpty.vcxproj
│ │ ├── TestRuntimeComponentEmpty.vcxproj.filters
│ │ ├── module.cpp
│ │ ├── pch.cpp
│ │ ├── pch.h
│ │ └── readme.txt
│ ├── TestRuntimeComponentNamespaceUnderscore
│ │ ├── PropertySheet.props
│ │ ├── TestRuntimeComponentNamespaceUnderscore.def
│ │ ├── TestRuntimeComponentNamespaceUnderscore.vcxproj
│ │ ├── TestRuntimeComponentNamespaceUnderscore.vcxproj.filters
│ │ ├── TestRuntimeComponentNamespaceUnderscoreClass.cpp
│ │ ├── TestRuntimeComponentNamespaceUnderscoreClass.h
│ │ ├── TestRuntimeComponentNamespaceUnderscoreClass.idl
│ │ ├── pch.cpp
│ │ ├── pch.h
│ │ └── readme.txt
│ ├── TestStaticLibrary1
│ │ ├── TestStaticLibrary1.vcxproj
│ │ ├── TestStaticLibrary1.vcxproj.filters
│ │ ├── TestStaticLibrary1Class.cpp
│ │ ├── TestStaticLibrary1Class.h
│ │ ├── TestStaticLibrary1Class.idl
│ │ ├── pch.cpp
│ │ └── pch.h
│ ├── TestStaticLibrary2
│ │ ├── TestStaticLibrary2.vcxproj
│ │ ├── TestStaticLibrary2.vcxproj.filters
│ │ ├── TestStaticLibrary2Class.cpp
│ │ ├── TestStaticLibrary2Class.h
│ │ ├── TestStaticLibrary2Class.idl
│ │ ├── pch.cpp
│ │ └── pch.h
│ ├── TestStaticLibrary3
│ │ ├── TestStaticLibrary3.vcxproj
│ │ ├── TestStaticLibrary3.vcxproj.filters
│ │ ├── TestStaticLibrary3Class.cpp
│ │ ├── TestStaticLibrary3Class.h
│ │ ├── TestStaticLibrary3Class.idl
│ │ ├── pch.cpp
│ │ └── pch.h
│ ├── TestStaticLibrary4
│ │ ├── TestStaticLibrary4.vcxproj
│ │ ├── TestStaticLibrary4.vcxproj.filters
│ │ ├── TestStaticLibrary4Class.cpp
│ │ ├── TestStaticLibrary4Class.h
│ │ ├── TestStaticLibrary4Class.idl
│ │ ├── pch.cpp
│ │ ├── pch.h
│ │ └── targetver.h
│ ├── TestStaticLibrary5
│ │ ├── TestStaticLibrary5.vcxproj
│ │ ├── TestStaticLibrary5.vcxproj.filters
│ │ ├── TestStaticLibrary5Class.cpp
│ │ ├── TestStaticLibrary5Class.h
│ │ ├── TestStaticLibrary5Class.idl
│ │ ├── pch.cpp
│ │ ├── pch.h
│ │ └── targetver.h
│ ├── TestStaticLibrary6
│ │ ├── TestNamespace.cpp
│ │ ├── TestNamespace.h
│ │ ├── TestNamespace.idl
│ │ ├── TestStaticLibrary6.vcxproj
│ │ ├── TestStaticLibrary6.vcxproj.filters
│ │ ├── TestStaticLibrary6Class.cpp
│ │ ├── TestStaticLibrary6Class.h
│ │ ├── TestStaticLibrary6Class.idl
│ │ ├── pch.cpp
│ │ ├── pch.h
│ │ └── targetver.h
│ └── TestStaticLibrary7
│ │ ├── PropertySheet.props
│ │ ├── TestStaticLibrary7.vcxproj
│ │ ├── TestStaticLibrary7.vcxproj.filters
│ │ ├── TestStaticLibrary7Class.cpp
│ │ ├── TestStaticLibrary7Class.h
│ │ ├── TestStaticLibrary7Class.idl
│ │ ├── pch.cpp
│ │ ├── pch.h
│ │ └── readme.txt
├── old_tests
│ ├── CMakeLists.txt
│ ├── Component
│ │ ├── Component.idl
│ │ ├── Component.vcxproj
│ │ ├── Component.vcxproj.filters
│ │ ├── Component_h.h
│ │ ├── CustomBase.cpp
│ │ ├── CustomBase.h
│ │ ├── Errors.cpp
│ │ ├── Errors.h
│ │ ├── Events.cpp
│ │ ├── Events.h
│ │ ├── FastInput.cpp
│ │ ├── FastInput.h
│ │ ├── FastInputMap.cpp
│ │ ├── FastInputMap.h
│ │ ├── FastInputVector.cpp
│ │ ├── FastInputVector.h
│ │ ├── NonCachedStatic.cpp
│ │ ├── NonCachedStatic.h
│ │ ├── Parameters.cpp
│ │ ├── Parameters.h
│ │ ├── Static.cpp
│ │ ├── Static.h
│ │ ├── Structures.cpp
│ │ ├── Structures.h
│ │ ├── module.def
│ │ ├── pch.cpp
│ │ └── pch.h
│ ├── Composable
│ │ ├── Base.cpp
│ │ ├── Base.h
│ │ ├── Composable.idl
│ │ ├── Composable.vcxproj
│ │ ├── Composable.vcxproj.filters
│ │ ├── Composable_h.h
│ │ ├── Derived.cpp
│ │ ├── Derived.h
│ │ ├── module.def
│ │ ├── precomp.cpp
│ │ └── precomp.hpp
│ └── UnitTests
│ │ ├── Bindable.cpp
│ │ ├── Boxing2.cpp
│ │ ├── CMakeLists.txt
│ │ ├── Composable.cpp
│ │ ├── Errors.cpp
│ │ ├── Events.cpp
│ │ ├── FastInput.cpp
│ │ ├── FastStrings.cpp
│ │ ├── Generics.cpp
│ │ ├── Hash.cpp
│ │ ├── IInspectable_GetIids.cpp
│ │ ├── IInspectable_GetRuntimeClassName.cpp
│ │ ├── IInspectable_GetTrustLevel.cpp
│ │ ├── IReference.cpp
│ │ ├── IUnknown_QueryInterface.cpp
│ │ ├── Main.cpp
│ │ ├── Parameters.cpp
│ │ ├── Reference.cpp
│ │ ├── References.cpp
│ │ ├── Release.cpp
│ │ ├── Security.cpp
│ │ ├── StructCodeGen.cpp
│ │ ├── Structures.cpp
│ │ ├── Tests.vcxproj
│ │ ├── Tests.vcxproj.filters
│ │ ├── TryLookup.cpp
│ │ ├── VariadicDelegate.cpp
│ │ ├── abi_guard.cpp
│ │ ├── agile_ref.cpp
│ │ ├── agility.cpp
│ │ ├── apartment_context.cpp
│ │ ├── array.cpp
│ │ ├── as.cpp
│ │ ├── as_implements.cpp
│ │ ├── async.cpp
│ │ ├── async_cancel.cpp
│ │ ├── boxing.cpp
│ │ ├── buffer.cpp
│ │ ├── capture.cpp
│ │ ├── casts.cpp
│ │ ├── char16.cpp
│ │ ├── clock.cpp
│ │ ├── collection_base.cpp
│ │ ├── com_ptr.cpp
│ │ ├── com_ref.cpp
│ │ ├── conditional_implements.cpp
│ │ ├── conditional_implements_pure.cpp
│ │ ├── constexpr.cpp
│ │ ├── create_instance.cpp
│ │ ├── delegate.cpp
│ │ ├── delegate_lambda.cpp
│ │ ├── delegate_weak_strong.cpp
│ │ ├── enum_flags.cpp
│ │ ├── error_chaining.cpp
│ │ ├── event_consume.cpp
│ │ ├── event_produce.cpp
│ │ ├── factory_cache.cpp
│ │ ├── foundation.cpp
│ │ ├── get_activation_factory.cpp
│ │ ├── handle.cpp
│ │ ├── hresult_error.cpp
│ │ ├── hstring.cpp
│ │ ├── hstring_builder.cpp
│ │ ├── implements_nested.cpp
│ │ ├── interop.cpp
│ │ ├── lock.cpp
│ │ ├── make_self.cpp
│ │ ├── marshal.cpp
│ │ ├── meta.cpp
│ │ ├── natvis.cpp
│ │ ├── param_hstring.cpp
│ │ ├── param_iterable.cpp
│ │ ├── param_map.cpp
│ │ ├── param_map_view.cpp
│ │ ├── param_vector.cpp
│ │ ├── param_vector_view.cpp
│ │ ├── pch.cpp
│ │ ├── pch.h
│ │ ├── produce.cpp
│ │ ├── produce_IPropertyValue.h
│ │ ├── produce_async.cpp
│ │ ├── produce_map.cpp
│ │ ├── produce_vector.cpp
│ │ ├── properties.cpp
│ │ ├── range_for.cpp
│ │ ├── reflect.cpp
│ │ ├── sdk.cpp
│ │ ├── single_threaded_map.cpp
│ │ ├── single_threaded_vector.cpp
│ │ ├── smart_pointers.cpp
│ │ ├── streams.cpp
│ │ ├── string_view_compare.h
│ │ ├── struct.cpp
│ │ ├── to_hstring.cpp
│ │ ├── weak.cpp
│ │ └── xaml_typename.cpp
├── test
│ ├── CMakeLists.txt
│ ├── GetMany.cpp
│ ├── abi_args.cpp
│ ├── abi_guard.cpp
│ ├── agile_ref.cpp
│ ├── agility.cpp
│ ├── async_auto_cancel.cpp
│ ├── async_cancel_callback.cpp
│ ├── async_check_cancel.cpp
│ ├── async_completed.cpp
│ ├── async_local.cpp
│ ├── async_no_suspend.cpp
│ ├── async_progress.cpp
│ ├── async_propagate_cancel.cpp
│ ├── async_result.cpp
│ ├── async_return.cpp
│ ├── async_suspend.cpp
│ ├── async_throw.cpp
│ ├── async_wait_for.cpp
│ ├── await_adapter.cpp
│ ├── await_completed.cpp
│ ├── box_array.cpp
│ ├── box_delegate.cpp
│ ├── box_guid.cpp
│ ├── capture.cpp
│ ├── cmd_reader.cpp
│ ├── coro_foundation.cpp
│ ├── coro_system.cpp
│ ├── coro_threadpool.cpp
│ ├── coro_ui_core.cpp
│ ├── custom_activation.cpp
│ ├── custom_error.cpp
│ ├── delegate.cpp
│ ├── delegates.cpp
│ ├── disconnected.cpp
│ ├── enum.cpp
│ ├── error_info.cpp
│ ├── event_clear.cpp
│ ├── event_deferral.cpp
│ ├── fast_iterator.cpp
│ ├── final_release.cpp
│ ├── generic_type_names.cpp
│ ├── generic_types.cpp
│ ├── generic_types.h
│ ├── get_activation_factory.cpp
│ ├── guid.cpp
│ ├── guid_include.cpp
│ ├── hresult_class_not_registered.cpp
│ ├── hstring_empty.cpp
│ ├── iid_ppv_args.cpp
│ ├── in_params.cpp
│ ├── in_params_abi.cpp
│ ├── initialize.cpp
│ ├── inspectable_interop.cpp
│ ├── interop.cpp
│ ├── invalid_events.cpp
│ ├── main.cpp
│ ├── memory_buffer.cpp
│ ├── missing_required_interfaces.cpp
│ ├── module_lock_dll.cpp
│ ├── multi_threaded_common.h
│ ├── multi_threaded_map.cpp
│ ├── multi_threaded_vector.cpp
│ ├── names.cpp
│ ├── no_make_detection.cpp
│ ├── noexcept.cpp
│ ├── numerics.cpp
│ ├── observable_index_of.cpp
│ ├── optional.cpp
│ ├── out_params.cpp
│ ├── out_params_abi.cpp
│ ├── out_params_bad.cpp
│ ├── parent_includes.cpp
│ ├── pch.cpp
│ ├── pch.h
│ ├── rational.cpp
│ ├── return_params.cpp
│ ├── return_params_abi.cpp
│ ├── single_threaded_observable_vector.cpp
│ ├── struct_delegate.cpp
│ ├── structs.cpp
│ ├── suppress_error_info.cpp
│ ├── tearoff.cpp
│ ├── test.vcxproj
│ ├── thread_pool.cpp
│ ├── uniform_in_params.cpp
│ ├── variadic_delegate.cpp
│ ├── velocity.cpp
│ └── when.cpp
├── test_component
│ ├── Class.cpp
│ ├── Class.h
│ ├── Optional.cpp
│ ├── Optional.h
│ ├── OverloadClass.cpp
│ ├── OverloadClass.h
│ ├── Simple.cpp
│ ├── Simple.h
│ ├── Velocity.Class1.cpp
│ ├── Velocity.Class1.h
│ ├── Velocity.Class2.cpp
│ ├── Velocity.Class2.h
│ ├── Velocity.Class4.cpp
│ ├── Velocity.Class4.h
│ ├── Windows.Class.cpp
│ ├── Windows.Class.h
│ ├── exports.def
│ ├── module.cpp
│ ├── pch.cpp
│ ├── pch.h
│ ├── test_auto.cpp
│ ├── test_component.idl
│ ├── test_component.vcxproj
│ └── test_overload.cpp
├── test_component_base
│ ├── HierarchyA.cpp
│ ├── HierarchyA.h
│ ├── HierarchyB.cpp
│ ├── HierarchyB.h
│ ├── exports.def
│ ├── pch.cpp
│ ├── pch.h
│ ├── test_component_base.idl
│ └── test_component_base.vcxproj
├── test_component_derived
│ ├── Nested.HierarchyC.cpp
│ ├── Nested.HierarchyC.h
│ ├── Nested.HierarchyD.cpp
│ ├── Nested.HierarchyD.h
│ ├── exports.def
│ ├── pch.cpp
│ ├── pch.h
│ ├── test_component_derived.idl
│ └── test_component_derived.vcxproj
├── test_component_fast
│ ├── Composition.CompositionObject.cpp
│ ├── Composition.CompositionObject.h
│ ├── Composition.Compositor.cpp
│ ├── Composition.Compositor.h
│ ├── Composition.SpriteVisual.cpp
│ ├── Composition.SpriteVisual.h
│ ├── Composition.Visual.cpp
│ ├── Composition.Visual.h
│ ├── Nomadic.cpp
│ ├── Nomadic.h
│ ├── Simple.cpp
│ ├── Simple.h
│ ├── exports.def
│ ├── pch.cpp
│ ├── pch.h
│ ├── test_component_fast.idl
│ └── test_component_fast.vcxproj
├── test_component_folders
│ ├── Class.cpp
│ ├── Class.h
│ ├── Nested.NestedClass.cpp
│ ├── Nested.NestedClass.h
│ ├── exports.def
│ ├── pch.cpp
│ ├── pch.h
│ ├── test_component_folders.idl
│ └── test_component_folders.vcxproj
├── test_component_no_pch
│ ├── Class.cpp
│ ├── Class.h
│ ├── exports.def
│ ├── test_component_no_pch.idl
│ └── test_component_no_pch.vcxproj
├── test_cpp20
│ ├── CMakeLists.txt
│ ├── array_span.cpp
│ ├── await_completed.cpp
│ ├── clang_only.cpp
│ ├── custom_error.cpp
│ ├── format.cpp
│ ├── hstring.cpp
│ ├── main.cpp
│ ├── pch.cpp
│ ├── pch.h
│ ├── ranges.cpp
│ └── test_cpp20.vcxproj
├── test_cpp20_no_sourcelocation
│ ├── CMakeLists.txt
│ ├── custom_error.cpp
│ ├── main.cpp
│ ├── pch.cpp
│ ├── pch.h
│ └── test_cpp20_no_sourcelocation.vcxproj
├── test_fast
│ ├── Composition.cpp
│ ├── Nomadic.cpp
│ ├── Simple.cpp
│ ├── main.cpp
│ ├── pch.cpp
│ ├── pch.h
│ └── test_fast.vcxproj
├── test_fast_fwd
│ ├── FastForwarderTest.idl
│ ├── FastForwarderTests.cpp
│ ├── main.cpp
│ ├── pch.cpp
│ ├── pch.h
│ ├── test_fast_fwd.vcxproj
│ └── test_fast_fwd.vcxproj.filters
├── test_module_lock_custom
│ ├── main.cpp
│ └── test_module_lock_custom.vcxproj
├── test_module_lock_none
│ ├── main.cpp
│ └── test_module_lock_none.vcxproj
└── test_slow
│ ├── Composition.cpp
│ ├── Simple.cpp
│ ├── main.cpp
│ ├── pch.cpp
│ ├── pch.h
│ └── test_slow.vcxproj
└── vsix
├── Dev16
├── Component
│ └── source.extension.vsixmanifest
├── Standalone
│ └── source.extension.vsixmanifest
├── VSPackage.cs
└── vsix.Dev16.csproj
├── Dev17
├── Component
│ └── source.extension.vsixmanifest
├── Standalone
│ └── source.extension.vsixmanifest
├── VSPackage.cs
└── vsix.Dev17.csproj
├── Directory.Build.Props
├── Extension.targets
├── ItemTemplates
├── BlankPage
│ ├── BlankPage.cpp
│ ├── BlankPage.h
│ ├── BlankPage.idl
│ ├── BlankPage.xaml
│ └── cppwinrt_BlankPage.vstemplate
├── BlankUserControl
│ ├── BlankUserControl.cpp
│ ├── BlankUserControl.h
│ ├── BlankUserControl.idl
│ ├── BlankUserControl.xaml
│ └── cppwinrt_BlankUserControl.vstemplate
├── VSTemplateDir.vstman
└── ViewModel
│ ├── ViewModel.cpp
│ ├── ViewModel.h
│ ├── ViewModel.idl
│ └── cppwinrt_ViewModel.vstemplate
├── ProjectTemplates
├── VC
│ ├── Windows Desktop
│ │ ├── ConsoleApplication
│ │ │ ├── ConsoleApplication.vcxproj
│ │ │ ├── ConsoleApplication.vcxproj.filters
│ │ │ ├── PropertySheet.props
│ │ │ ├── cppwinrt_ConsoleApplication.vstemplate
│ │ │ ├── main.cpp
│ │ │ ├── pch.cpp
│ │ │ ├── pch.h
│ │ │ └── readme.txt
│ │ └── WindowsApplication
│ │ │ ├── PropertySheet.props
│ │ │ ├── WindowsApplication.exe.manifest
│ │ │ ├── WindowsApplication.rc
│ │ │ ├── WindowsApplication.vcxproj
│ │ │ ├── WindowsApplication.vcxproj.filters
│ │ │ ├── cppwinrt_WindowsApplication.vstemplate
│ │ │ ├── pch.cpp
│ │ │ ├── pch.h
│ │ │ ├── readme.txt
│ │ │ ├── resource.h
│ │ │ └── winmain.cpp
│ └── Windows Universal
│ │ ├── BlankApp
│ │ ├── App.cpp
│ │ ├── App.h
│ │ ├── App.idl
│ │ ├── App.xaml
│ │ ├── BlankApp.vcxproj
│ │ ├── BlankApp.vcxproj.filters
│ │ ├── LockScreenLogo.scale-200.png
│ │ ├── MainPage.cpp
│ │ ├── MainPage.h
│ │ ├── MainPage.idl
│ │ ├── MainPage.xaml
│ │ ├── Package.appxmanifest
│ │ ├── PropertySheet.props
│ │ ├── SplashScreen.scale-200.png
│ │ ├── Square150x150Logo.scale-200.png
│ │ ├── Square44x44Logo.scale-200.png
│ │ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ │ ├── StoreLogo.png
│ │ ├── Wide310x150Logo.scale-200.png
│ │ ├── cppwinrt_BlankApp.vstemplate
│ │ ├── pch.cpp
│ │ ├── pch.h
│ │ └── readme.txt
│ │ ├── CoreApp
│ │ ├── App.cpp
│ │ ├── CoreApp.vcxproj
│ │ ├── CoreApp.vcxproj.filters
│ │ ├── LockScreenLogo.scale-200.png
│ │ ├── Package.appxmanifest
│ │ ├── PropertySheet.props
│ │ ├── SplashScreen.scale-200.png
│ │ ├── Square150x150Logo.scale-200.png
│ │ ├── Square44x44Logo.scale-200.png
│ │ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ │ ├── StoreLogo.png
│ │ ├── Wide310x150Logo.scale-200.png
│ │ ├── cppwinrt_CoreApp.vstemplate
│ │ ├── pch.cpp
│ │ ├── pch.h
│ │ └── readme.txt
│ │ ├── StaticLibrary
│ │ ├── Class.cpp
│ │ ├── Class.h
│ │ ├── Class.idl
│ │ ├── PropertySheet.props
│ │ ├── StaticLibrary.vcxproj
│ │ ├── StaticLibrary.vcxproj.filters
│ │ ├── cppwinrt_StaticLibrary.vstemplate
│ │ ├── pch.cpp
│ │ ├── pch.h
│ │ └── readme.txt
│ │ └── WindowsRuntimeComponent
│ │ ├── Class.cpp
│ │ ├── Class.h
│ │ ├── Class.idl
│ │ ├── PropertySheet.props
│ │ ├── WindowsRuntimeComponent.def
│ │ ├── WindowsRuntimeComponent.vcxproj
│ │ ├── WindowsRuntimeComponent.vcxproj.filters
│ │ ├── cppwinrt_WindowsRuntimeComponent.vstemplate
│ │ ├── pch.cpp
│ │ ├── pch.h
│ │ └── readme.txt
└── VSTemplateDir.vstman
├── Resources
├── VSPackage.resx
├── cs-CZ
│ └── VSPackage.cs-CZ.resx
├── de-DE
│ └── VSPackage.de-DE.resx
├── es-ES
│ └── VSPackage.es-ES.resx
├── fr-FR
│ └── VSPackage.fr-FR.resx
├── it-IT
│ └── VSPackage.it-IT.resx
├── ja-JP
│ └── VSPackage.ja-JP.resx
├── ko-KR
│ └── VSPackage.ko-KR.resx
├── pl-PL
│ └── VSPackage.pl-PL.resx
├── pt-BR
│ └── VSPackage.pt-BR.resx
├── ru-RU
│ └── VSPackage.ru-RU.resx
├── tr-TR
│ └── VSPackage.tr-TR.resx
├── zh-CN
│ └── VSPackage.zh-CN.resx
└── zh-TW
│ └── VSPackage.zh-TW.resx
├── SignConfig.xml
├── cppwinrt.ico
├── cppwinrt.png
├── cppwinrt.xcf
├── extension.manifest.json
├── overview.md
├── readme.md
└── vsix.sln
/.config/1espt/PipelineAutobaseliningConfig.yml:
--------------------------------------------------------------------------------
1 | ## DO NOT MODIFY THIS FILE MANUALLY. This is part of auto-baselining from 1ES Pipeline Templates. Go to [https://aka.ms/1espt-autobaselining] for more details.
2 |
3 | pipelines:
4 | 98194:
5 | retail:
6 | source:
7 | credscan:
8 | lastModifiedDate: 2023-12-06
9 | eslint:
10 | lastModifiedDate: 2023-12-06
11 | psscriptanalyzer:
12 | lastModifiedDate: 2023-12-06
13 | armory:
14 | lastModifiedDate: 2023-12-06
15 |
--------------------------------------------------------------------------------
/.config/tsaoptions.json:
--------------------------------------------------------------------------------
1 | {
2 | "instanceUrl": "https://microsoft.visualstudio.com",
3 | "projectName": "os",
4 | "areaPath": "OS\\Windows Client and Services\\WinPD\\DEEP-Developer Experience, Ecosystem and Partnerships\\AmUse- App Metadata and User Setup Experience\\Projections\\Cppwinrt",
5 | "notificationAliases": [ "cpp4uwpt@microsoft.com" ],
6 | "ignoreBranchName": true,
7 | "codebaseName": "cppwinrt"
8 | }
9 |
--------------------------------------------------------------------------------
/.gdn/.gdnsettings:
--------------------------------------------------------------------------------
1 | {
2 | "files": { },
3 | "folders": { },
4 | "overwriteLogs": true,
5 | "telemetryFlushTimeout": 10,
6 | "variables": { }
7 | }
--------------------------------------------------------------------------------
/.gdn/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Guardian internal files
2 | .r/
3 | rc/
4 | rs/
5 | i/
6 | p/
7 | c/
8 | o/
9 |
10 | ## Ignore Guardian Local settings
11 | LocalSettings.gdn.json
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | * text eol=lf
3 | *.png -text
4 | *.exe -text
5 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: Visual Studio or C++ question
4 | url: https://developercommunity.visualstudio.com/cpp
5 | about: Your open channel to Microsoft engineering teams
6 | - name: Windows API question
7 | url: https://docs.microsoft.com/en-us/answers/topics/windows-api.html
8 | about: Please ask questions about the Windows API on Microsoft Q&A
9 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: "cargo"
4 | directory: "/"
5 | schedule:
6 | interval: "daily"
7 | - package-ecosystem: "github-actions"
8 | directory: "/"
9 | schedule:
10 | interval: "daily"
11 |
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 | What's this all about?
2 |
3 | Fixes: #0000 ⬅️ Be sure to refer to an existing issue here!
4 |
--------------------------------------------------------------------------------
/.github/workflows/stale.yml:
--------------------------------------------------------------------------------
1 | name: Mark stale issues and pull requests
2 |
3 | on:
4 | schedule:
5 | - cron: '0 0 * * *'
6 |
7 | jobs:
8 | stale:
9 |
10 | runs-on: ubuntu-latest
11 | permissions:
12 | issues: write
13 | pull-requests: write
14 |
15 | steps:
16 | - uses: actions/stale@v9
17 | with:
18 | repo-token: ${{ secrets.GITHUB_TOKEN }}
19 | days-before-stale: 10
20 | days-before-close: 5
21 | stale-issue-message: 'This issue is stale because it has been open 10 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
22 | stale-pr-message: 'This pull request is stale because it has been open 10 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
23 | stale-issue-label: 'no-issue-activity'
24 | stale-pr-label: 'no-pr-activity'
25 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .nuget
2 | .vscode
3 | .vs
4 | *.user
5 | *_i.c
6 | *_p.c
7 | *.c
8 | *.nupkg
9 | test*.xml
10 | test*_results.txt
11 | test_failures.txt
12 | build
13 | packages
14 | Debug
15 | Release
16 | Generated Files
17 | obj
18 | vsix/LICENSE
19 |
--------------------------------------------------------------------------------
/.pipelines/variables/OneBranchVariables.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | - name: 'debug'
3 | displayName: 'Enable debug output'
4 | type: boolean
5 | default: false
6 |
7 | variables:
8 | system.debug: ${{ parameters.debug }}
9 | ENABLE_PRS_DELAYSIGN: 1
10 | NUGET_XMLDOC_MODE: none
11 |
12 | # Docker image which is used to build the project https://aka.ms/obpipelines/containers
13 | WindowsContainerImage: 'onebranch.azurecr.io/windows/ltsc2022/vse2022:latest'
14 |
15 | Codeql.Enabled: true # CodeQL once every 3 days on the default branch for all languages its applicable to in that pipeline.
16 | GDN_USE_DOTNET: true
--------------------------------------------------------------------------------
/.pipelines/variables/version.yml:
--------------------------------------------------------------------------------
1 | variables:
2 | MajorVersion: "2"
3 | MinorVersion: "0"
4 | VersionDate: $[format('{0:yyMMdd}', pipeline.startTime)]
5 | VersionCounter: $[counter(variables['VersionDate'], 1)]
6 | BuildVersion: $(MajorVersion).$(MinorVersion).$(VersionDate).$(VersionCounter)
7 | PatchVersion: $(VersionDate)$(VersionCounter)
--------------------------------------------------------------------------------
/Directory.Packages.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Microsoft Corporation.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE
22 |
--------------------------------------------------------------------------------
/build_nuget.cmd:
--------------------------------------------------------------------------------
1 | rem @echo off
2 |
3 | set target_version=%1
4 | if "%target_version%"=="" set target_version=3.0.0.0
5 |
6 | call msbuild /m /p:Configuration=Release,Platform=x86,CppWinRTBuildVersion=%target_version% cppwinrt.sln /t:fast_fwd
7 | call msbuild /m /p:Configuration=Release,Platform=x64,CppWinRTBuildVersion=%target_version% cppwinrt.sln /t:fast_fwd
8 | call msbuild /m /p:Configuration=Release,Platform=arm64,CppWinRTBuildVersion=%target_version% cppwinrt.sln /t:fast_fwd
9 |
10 | call msbuild /m /p:Configuration=Release,Platform=x86,CppWinRTBuildVersion=%target_version% cppwinrt.sln /t:cppwinrt
11 |
12 | nuget pack nuget\Microsoft.Windows.CppWinRT.nuspec -Properties target_version=%target_version%;cppwinrt_exe=%cd%\_build\x86\Release\cppwinrt.exe;cppwinrt_fast_fwd_x86=%cd%\_build\x86\Release\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_x64=%cd%\_build\x64\Release\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_arm64=%cd%\_build\arm64\Release\cppwinrt_fast_forwarder.lib
13 |
--------------------------------------------------------------------------------
/build_projection.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | setlocal ENABLEDELAYEDEXPANSION
4 |
5 | set target_platform=%1
6 | set target_configuration=%2
7 | if "%target_platform%"=="" set target_platform=x64
8 |
9 | if /I "%target_platform%" equ "all" (
10 | if "%target_configuration%"=="" (
11 | set target_configuration=all
12 | )
13 | call %0 x86 !target_configuration!
14 | call %0 x64 !target_configuration!
15 | call %0 arm64 !target_configuration!
16 | goto :eof
17 | )
18 |
19 | if /I "%target_configuration%" equ "all" (
20 | call %0 %target_platform% Debug
21 | call %0 %target_platform% Release
22 | goto :eof
23 | )
24 |
25 | if "%target_configuration%"=="" (
26 | set target_configuration=Debug
27 | )
28 |
29 | set cppwinrt_exe=%~p0\_build\x64\Release\cppwinrt.exe
30 |
31 | if not exist "%cppwinrt_exe%" (
32 | echo Remember to build the "prebuild" and then "cppwinrt" projects for Release x64 first
33 | goto :eof
34 | )
35 |
36 | echo Building projection into %target_platform% %target_configuration%
37 | %cppwinrt_exe% -in local -out %~p0\_build\%target_platform%\%target_configuration% -verbose
38 | echo.
39 |
--------------------------------------------------------------------------------
/compile_tests.cmd:
--------------------------------------------------------------------------------
1 | cl /EHsc /std:c++17 /MP /I ..\..\..\_build\Windows\x64\Debug\tool\cppwinrt ..\..\..\_build\Windows\x64\Debug\tool\cppwinrt\tests\*.cpp
2 |
--------------------------------------------------------------------------------
/cppwinrt/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | true
6 | UTF-8
7 |
8 |
9 |
--------------------------------------------------------------------------------
/cppwinrt/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/cppwinrt/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/cppwinrt/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "cmd_reader.h"
5 | #include
6 | #include "task_group.h"
7 | #include "text_writer.h"
8 |
--------------------------------------------------------------------------------
/cppwinrt/settings.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace cppwinrt
4 | {
5 | struct settings_type
6 | {
7 | std::set input;
8 | std::set reference;
9 |
10 | std::string output_folder;
11 | bool base{};
12 | bool license{};
13 | std::string license_template;
14 | bool brackets{};
15 | bool verbose{};
16 | bool component{};
17 | std::string component_folder;
18 | std::string component_name;
19 | std::string component_pch;
20 | bool component_prefix{};
21 | bool component_overwrite{};
22 | std::string component_lib;
23 | bool component_opt{};
24 | bool component_ignore_velocity{};
25 |
26 | std::set include;
27 | std::set exclude;
28 |
29 | winmd::reader::filter projection_filter;
30 | winmd::reader::filter component_filter;
31 |
32 | bool fastabi{};
33 | std::map fastabi_cache;
34 | };
35 |
36 | extern settings_type settings;
37 | }
38 |
--------------------------------------------------------------------------------
/docs/code_of_conduct.md:
--------------------------------------------------------------------------------
1 | # Microsoft Open Source Code of Conduct
2 |
3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
4 |
5 | Resources:
6 |
7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns
--------------------------------------------------------------------------------
/fast_fwd/win32/thunks.asm:
--------------------------------------------------------------------------------
1 | ; i386 fast forwarder thunk implementations
2 | ; Calling convention: https://docs.microsoft.com/en-us/cpp/cpp/stdcall
3 |
4 | .MODEL FLAT
5 |
6 | extrn ___guard_check_icall_fptr:DWORD
7 |
8 | .CODE
9 |
10 | InvokeForwarder PROC
11 |
12 | ; Replace forwarder abi with owner abi
13 | mov ecx, dword ptr[esp + 4]
14 | mov edx, dword ptr[ecx + 4]
15 | mov [esp + 4], edx
16 |
17 | ; Add offset and index
18 | add eax, dword ptr [ecx + 8]
19 |
20 | ; Get method address from owner abi vtable
21 | mov ecx, dword ptr [edx]
22 | mov eax, dword ptr [ecx + eax * 4]
23 |
24 | ; Verify indirect call target
25 | call [___guard_check_icall_fptr]
26 |
27 | ; Jump to method
28 | jmp eax
29 |
30 | InvokeForwarder ENDP
31 |
32 | ; Define thunks
33 | WINRT_FF_THUNK MACRO i
34 | _winrt_ff_thunk&i&@0 PROC
35 | mov eax, i
36 | jmp InvokeForwarder
37 | _winrt_ff_thunk&i&@0 ENDP
38 | PUBLIC _winrt_ff_thunk&i&@0
39 | ENDM
40 |
41 | include thunks.inc
42 |
43 | END
--------------------------------------------------------------------------------
/mingw-support/xmllite.def:
--------------------------------------------------------------------------------
1 | LIBRARY "XmlLite.dll"
2 | EXPORTS
3 | CreateXmlReader
4 | CreateXmlReaderInputWithEncodingCodePage
5 | CreateXmlReaderInputWithEncodingName
6 | CreateXmlWriter
7 | CreateXmlWriterOutputWithEncodingCodePage
8 | CreateXmlWriterOutputWithEncodingName
9 |
--------------------------------------------------------------------------------
/mingw-support/xmllite_i386.def:
--------------------------------------------------------------------------------
1 | LIBRARY "XmlLite.dll"
2 | EXPORTS
3 | CreateXmlReader@12
4 | CreateXmlReaderInputWithEncodingCodePage@24
5 | CreateXmlReaderInputWithEncodingName@24
6 | CreateXmlWriter@12
7 | CreateXmlWriterOutputWithEncodingCodePage@16
8 | CreateXmlWriterOutputWithEncodingName@16
9 |
--------------------------------------------------------------------------------
/natvis/SignConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/natvis/cppwinrtvisualizer.def:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Microsoft. All rights reserved.
2 | ; Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | LIBRARY "CppWinRTVisualizer.DLL"
5 |
6 | EXPORTS
7 | DllCanUnloadNow PRIVATE
8 | DllGetClassObject PRIVATE
--------------------------------------------------------------------------------
/natvis/cppwinrtvisualizer.vsdconfigxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/natvis/cppwinrtvisualizer15.vsdconfigxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/natvis/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/natvis/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
--------------------------------------------------------------------------------
/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/nuget/SignConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/prebuild/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.16)
2 |
3 | project(cppwinrt-prebuild LANGUAGES CXX)
4 |
5 | set(CMAKE_CXX_STANDARD 17)
6 | set(CMAKE_CXX_STANDARD_REQUIRED True)
7 |
8 | if(NOT DEFINED CPPWINRT_BUILD_VERSION)
9 | message(FATAL_ERROR "CPPWINRT_BUILD_VERSION has not been defined. You should build the top-level project instead.")
10 | endif()
11 |
12 |
13 | set(PREBUILD_SRCS
14 | main.cpp
15 | pch.h
16 | )
17 | add_executable(cppwinrt-prebuild ${PREBUILD_SRCS})
18 | target_compile_definitions(cppwinrt-prebuild PRIVATE CPPWINRT_VERSION_STRING="${CPPWINRT_BUILD_VERSION}")
19 | target_include_directories(cppwinrt-prebuild PRIVATE ../cppwinrt/)
20 |
21 | if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
22 | install(TARGETS cppwinrt-prebuild)
23 | endif()
24 |
--------------------------------------------------------------------------------
/prebuild/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/prebuild/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "text_writer.h"
4 |
--------------------------------------------------------------------------------
/run_tests.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 | setlocal
3 |
4 | set target_platform=%1
5 | set target_configuration=%2
6 | set target_version=%3
7 |
8 | if "%target_platform%"=="" set target_platform=x64
9 | if "%target_configuration%"=="" set target_configuration=Debug
10 |
11 | call :run_test test
12 | call :run_test test_cpp20
13 | call :run_test test_cpp20_no_sourcelocation
14 | call :run_test test_fast
15 | call :run_test test_slow
16 | call :run_test test_old
17 | call :run_test test_module_lock_custom
18 | call :run_test test_module_lock_none
19 | goto :eof
20 |
21 | :run_test
22 | if not "%target_version%"=="" set args=-o %1-%target_version%.xml -r junit
23 | rem Buffer output and redirect to stdout/stderr depending whether the test executable exits successfully. Pipeline will fail if there's any output to stderr.
24 | _build\%target_platform%\%target_configuration%\%1.exe %args% > %1_results.txt
25 | if %ERRORLEVEL% EQU 0 (
26 | type %1_results.txt
27 | ) else (
28 | type %1_results.txt >&2
29 | echo %1 >> test_failures.txt
30 | )
31 | goto :eof
32 |
--------------------------------------------------------------------------------
/scratch/main.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
3 | using namespace winrt;
4 |
5 | int main()
6 | {
7 | }
8 |
--------------------------------------------------------------------------------
/scratch/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/scratch/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "winrt/Windows.Foundation.Collections.h"
4 |
--------------------------------------------------------------------------------
/strings/base_reference_produce_1.h:
--------------------------------------------------------------------------------
1 |
2 | WINRT_EXPORT namespace winrt::Windows::Foundation
3 | {
4 | template
5 | bool operator==(IReference const& left, IReference const& right);
6 |
7 | template
8 | bool operator!=(IReference const& left, IReference const& right);
9 | }
10 |
--------------------------------------------------------------------------------
/strings/base_stringable_format.h:
--------------------------------------------------------------------------------
1 |
2 | #ifdef __cpp_lib_format
3 | template
4 | auto std::formatter::format(winrt::Windows::Foundation::IStringable const& obj, FormatContext& fc) const
5 | {
6 | return std::formatter::format(obj.ToString(), fc);
7 | }
8 | #endif
9 |
--------------------------------------------------------------------------------
/strings/base_stringable_format_1.h:
--------------------------------------------------------------------------------
1 |
2 | #ifdef __cpp_lib_format
3 | template <>
4 | struct std::formatter : std::formatter
5 | {
6 | template
7 | auto format(winrt::Windows::Foundation::IStringable const& obj, FormatContext& fc) const;
8 | };
9 | #endif
10 |
--------------------------------------------------------------------------------
/strings/base_stringable_streams.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef WINRT_LEAN_AND_MEAN
3 | inline std::wostream& operator<<(std::wostream& stream, winrt::Windows::Foundation::IStringable const& stringable)
4 | {
5 | stream << stringable.ToString();
6 | return stream;
7 | }
8 | #endif
9 |
--------------------------------------------------------------------------------
/strings/base_stringable_to_hstring.h:
--------------------------------------------------------------------------------
1 |
2 | WINRT_EXPORT namespace winrt
3 | {
4 | inline hstring to_hstring(Windows::Foundation::IStringable const& stringable)
5 | {
6 | return stringable.ToString();
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/strings/base_version.h:
--------------------------------------------------------------------------------
1 |
2 | // WINRT_version is used by Microsoft to analyze C++/WinRT library adoption and inform future product decisions.
3 | extern "C"
4 | __declspec(selectany)
5 | char const * const WINRT_version = "C++/WinRT version:" CPPWINRT_VERSION;
6 |
7 | #if defined(_MSC_VER)
8 | #ifdef _M_IX86
9 | #pragma comment(linker, "/include:_WINRT_version")
10 | #else
11 | #pragma comment(linker, "/include:WINRT_version")
12 | #endif
13 |
14 | #pragma detect_mismatch("C++/WinRT version", CPPWINRT_VERSION)
15 | #endif
16 |
17 | WINRT_EXPORT namespace winrt
18 | {
19 | template
20 | constexpr bool check_version(char const(&base)[BaseSize], char const(&component)[ComponentSize]) noexcept
21 | {
22 | if constexpr (BaseSize != ComponentSize)
23 | {
24 | return false;
25 | }
26 |
27 | for (size_t i = 0; i != BaseSize - 1; ++i)
28 | {
29 | if (base[i] != component[i])
30 | {
31 | return false;
32 | }
33 | }
34 |
35 | return true;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/strings/base_version_odr.h:
--------------------------------------------------------------------------------
1 | #define CPPWINRT_VERSION "%"
2 |
3 |
--------------------------------------------------------------------------------
/test/mingw_com_support.h:
--------------------------------------------------------------------------------
1 | #if defined(__clang__)
2 | #define HAS_DECLSPEC_UUID __has_declspec_attribute(uuid)
3 | #elif defined(_MSC_VER)
4 | #define HAS_DECLSPEC_UUID 1
5 | #else
6 | #define HAS_DECLSPEC_UUID 0
7 | #endif
8 |
9 | #if HAS_DECLSPEC_UUID
10 | #define DECLSPEC_UUID(x) __declspec(uuid(x))
11 | #else
12 | #define DECLSPEC_UUID(x)
13 | #endif
14 |
--------------------------------------------------------------------------------
/test/nuget/ConsoleApplication1/ConsoleApplication1Class.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "ConsoleApplication1Class.h"
3 | #include "ConsoleApplication1Class.g.cpp"
4 |
5 | namespace winrt::ConsoleApplication1::implementation
6 | {
7 | void ConsoleApplication1Class::Test()
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/nuget/ConsoleApplication1/ConsoleApplication1Class.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "ConsoleApplication1Class.g.h"
3 |
4 | namespace winrt::ConsoleApplication1::implementation
5 | {
6 | struct ConsoleApplication1Class : ConsoleApplication1ClassT
7 | {
8 | ConsoleApplication1Class() = default;
9 |
10 | void Test();
11 | };
12 | }
13 | namespace winrt::ConsoleApplication1::factory_implementation
14 | {
15 | struct ConsoleApplication1Class : ConsoleApplication1ClassT
16 | {
17 | };
18 | }
19 |
--------------------------------------------------------------------------------
/test/nuget/ConsoleApplication1/ConsoleApplication1Class.idl:
--------------------------------------------------------------------------------
1 | namespace ConsoleApplication1
2 | {
3 | [default_interface]
4 | runtimeclass ConsoleApplication1Class
5 | {
6 | ConsoleApplication1Class();
7 | void Test();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/test/nuget/ConsoleApplication1/PropertySheet.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/test/nuget/ConsoleApplication1/main.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
3 | using namespace winrt;
4 | using namespace Windows::Foundation;
5 |
6 | int main()
7 | {
8 | init_apartment();
9 | Uri uri(L"http://aka.ms/cppwinrt");
10 | printf("Hello, %ls!\n", uri.AbsoluteUri().c_str());
11 | }
12 |
--------------------------------------------------------------------------------
/test/nuget/ConsoleApplication1/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/test/nuget/ConsoleApplication1/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 |
--------------------------------------------------------------------------------
/test/nuget/Directory.Build.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/test/nuget/TestApp/App.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "App.xaml.g.h"
3 |
4 | namespace winrt::TestApp::implementation
5 | {
6 | struct App : AppT
7 | {
8 | App();
9 |
10 | void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs const&);
11 | void OnSuspending(IInspectable const&, Windows::ApplicationModel::SuspendingEventArgs const&);
12 | void OnNavigationFailed(IInspectable const&, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs const&);
13 | };
14 | }
15 |
--------------------------------------------------------------------------------
/test/nuget/TestApp/App.idl:
--------------------------------------------------------------------------------
1 | namespace TestApp
2 | {
3 | }
4 |
--------------------------------------------------------------------------------
/test/nuget/TestApp/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/test/nuget/TestApp/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/cppwinrt/4c9e03fe1e3d7cbfbf742ec237e9af5b30add68a/test/nuget/TestApp/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/test/nuget/TestApp/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/cppwinrt/4c9e03fe1e3d7cbfbf742ec237e9af5b30add68a/test/nuget/TestApp/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/test/nuget/TestApp/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/cppwinrt/4c9e03fe1e3d7cbfbf742ec237e9af5b30add68a/test/nuget/TestApp/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/test/nuget/TestApp/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/cppwinrt/4c9e03fe1e3d7cbfbf742ec237e9af5b30add68a/test/nuget/TestApp/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/test/nuget/TestApp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/cppwinrt/4c9e03fe1e3d7cbfbf742ec237e9af5b30add68a/test/nuget/TestApp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/test/nuget/TestApp/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/cppwinrt/4c9e03fe1e3d7cbfbf742ec237e9af5b30add68a/test/nuget/TestApp/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/test/nuget/TestApp/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/cppwinrt/4c9e03fe1e3d7cbfbf742ec237e9af5b30add68a/test/nuget/TestApp/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/test/nuget/TestApp/MainPage.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "MainPage.g.h"
4 |
5 | namespace winrt::TestApp::implementation
6 | {
7 | struct MainPage : MainPageT
8 | {
9 | MainPage();
10 |
11 | int32_t MyProperty();
12 | void MyProperty(int32_t value);
13 |
14 | void ClickHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args);
15 | };
16 | }
17 |
18 | namespace winrt::TestApp::factory_implementation
19 | {
20 | struct MainPage : MainPageT
21 | {
22 | };
23 | }
24 |
--------------------------------------------------------------------------------
/test/nuget/TestApp/MainPage.idl:
--------------------------------------------------------------------------------
1 | namespace TestApp
2 | {
3 | [default_interface]
4 | runtimeclass MainPage : Windows.UI.Xaml.Controls.Page
5 | {
6 | MainPage();
7 | Int32 MyProperty;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/test/nuget/TestApp/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/test/nuget/TestApp/PropertySheet.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/test/nuget/TestApp/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/test/nuget/TestApp/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 |
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 |
--------------------------------------------------------------------------------
/test/nuget/TestProxyStub/IAsyncContract.idl:
--------------------------------------------------------------------------------
1 | import "Windows.Foundation.idl";
2 | import "IAsyncContractParameter.idl";
3 |
4 | namespace TestProxyStub
5 | {
6 | [uuid("A388AC69-7C0F-4CCB-B108-E091BE3DAB88")]
7 | interface IAsyncContract
8 | {
9 | Windows.Foundation.IAsyncAction RunAsync(IAsyncContractParameter parameter);
10 | };
11 | }
12 |
--------------------------------------------------------------------------------
/test/nuget/TestProxyStub/IAsyncContractParameter.idl:
--------------------------------------------------------------------------------
1 | import "Windows.Foundation.idl";
2 |
3 | namespace TestProxyStub
4 | {
5 | [uuid("F219AC9A-9858-4F66-8DA7-47A9E08438AC")]
6 | interface IAsyncContractParameter
7 | {
8 | String Name{ get; };
9 | Object Details{ get; };
10 | };
11 | }
12 |
--------------------------------------------------------------------------------
/test/nuget/TestProxyStub/TestProxyStub.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | DllCanUnloadNow PRIVATE
3 | DllGetClassObject PRIVATE
--------------------------------------------------------------------------------
/test/nuget/TestProxyStub/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/test/nuget/TestProxyStub/pch.h:
--------------------------------------------------------------------------------
1 | //
2 | // pch.h
3 | // Header for platform projection include files
4 | //
5 |
6 | #pragma once
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent1/PropertySheet.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent1/TestRuntimeComponent1.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE
3 | DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE
4 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent1/TestRuntimeComponent1.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | accd3aa8-1ba0-4223-9bbe-0c431709210b
6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
7 |
8 |
9 | {926ab91d-31b4-48c3-b9a4-e681349f27f0}
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent1/TestRuntimeComponent1Class.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "TestRuntimeComponent1Class.h"
3 | #include "TestRuntimeComponent1Class.g.cpp"
4 |
5 | namespace winrt::TestRuntimeComponent1::implementation
6 | {
7 | void TestRuntimeComponent1Class::Test()
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent1/TestRuntimeComponent1Class.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "TestRuntimeComponent1Class.g.h"
3 |
4 | namespace winrt::TestRuntimeComponent1::implementation
5 | {
6 | struct TestRuntimeComponent1Class : TestRuntimeComponent1ClassT
7 | {
8 | TestRuntimeComponent1Class() = default;
9 |
10 | void Test();
11 | };
12 | }
13 | namespace winrt::TestRuntimeComponent1::factory_implementation
14 | {
15 | struct TestRuntimeComponent1Class : TestRuntimeComponent1ClassT
16 | {
17 | };
18 | }
19 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent1/TestRuntimeComponent1Class.idl:
--------------------------------------------------------------------------------
1 | namespace TestRuntimeComponent1
2 | {
3 | [default_interface]
4 | runtimeclass TestRuntimeComponent1Class
5 | {
6 | TestRuntimeComponent1Class();
7 | void Test();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent1/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent1/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | #include
5 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent2/PropertySheet.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent2/TestRuntimeComponent2.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE
3 | DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE
4 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent2/TestRuntimeComponent2Class.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "TestRuntimeComponent2Class.h"
3 | #include "TestRuntimeComponent2Class.g.cpp"
4 |
5 | namespace winrt::TestRuntimeComponent2::implementation
6 | {
7 | void TestRuntimeComponent2Class::Test()
8 | {
9 | TestStaticLibrary2Class c{};
10 | c.Test();
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent2/TestRuntimeComponent2Class.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "TestRuntimeComponent2Class.g.h"
3 |
4 | namespace winrt::TestRuntimeComponent2::implementation
5 | {
6 | struct TestRuntimeComponent2Class : TestRuntimeComponent2ClassT
7 | {
8 | TestRuntimeComponent2Class() = default;
9 |
10 | void Test();
11 | };
12 | }
13 | namespace winrt::TestRuntimeComponent2::factory_implementation
14 | {
15 | struct TestRuntimeComponent2Class : TestRuntimeComponent2ClassT
16 | {
17 | };
18 | }
19 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent2/TestRuntimeComponent2Class.idl:
--------------------------------------------------------------------------------
1 | namespace TestRuntimeComponent2
2 | {
3 | [default_interface]
4 | runtimeclass TestRuntimeComponent2Class
5 | {
6 | TestRuntimeComponent2Class();
7 |
8 | void Test();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent2/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent2/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | #include
5 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent3/PropertySheet.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent3/TestRuntimeComponent3.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE
3 | DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE
4 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent3/TestRuntimeComponent3Class.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "TestRuntimeComponent3Class.h"
3 | #include "TestRuntimeComponent3Class.g.cpp"
4 |
5 | using namespace winrt::TestRuntimeComponentCSharp;
6 |
7 | namespace winrt::TestRuntimeComponent3::implementation
8 | {
9 | void TestRuntimeComponent3Class::Test()
10 | {
11 | TestStaticLibrary3Class c{};
12 | c.Test();
13 |
14 | TestRuntimeComponentCSharpClass csharp{};
15 | csharp.Test();
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent3/TestRuntimeComponent3Class.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "TestRuntimeComponent3Class.g.h"
3 |
4 | namespace winrt::TestRuntimeComponent3::implementation
5 | {
6 | struct TestRuntimeComponent3Class : TestRuntimeComponent3ClassT
7 | {
8 | TestRuntimeComponent3Class() = default;
9 |
10 | void Test();
11 | };
12 | }
13 | namespace winrt::TestRuntimeComponent3::factory_implementation
14 | {
15 | struct TestRuntimeComponent3Class : TestRuntimeComponent3ClassT
16 | {
17 | };
18 | }
19 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent3/TestRuntimeComponent3Class.idl:
--------------------------------------------------------------------------------
1 | namespace TestRuntimeComponent3
2 | {
3 | [default_interface]
4 | runtimeclass TestRuntimeComponent3Class
5 | {
6 | TestRuntimeComponent3Class();
7 |
8 | void Test();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent3/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponent3/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | #include
5 |
6 | #include
7 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentCSharp/TestRuntimeComponentCSharpClass.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace TestRuntimeComponentCSharp
8 | {
9 | public sealed class TestRuntimeComponentCSharpClass
10 | {
11 | public void Test()
12 | {
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentCX/TestRuntimeComponentCX.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 4c8f39f9-55d6-4b60-929d-30de4c560216
6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentCX/TestRuntimeComponentCXClass.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "TestRuntimeComponentCXClass.h"
3 |
4 | using namespace Platform;
5 |
6 | namespace TestRuntimeComponentCX
7 | {
8 | TestRuntimeComponentCXClass::TestRuntimeComponentCXClass()
9 | {
10 | }
11 |
12 | void TestRuntimeComponentCXClass::Test()
13 | {
14 | }
15 | }
16 |
17 |
18 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentCX/TestRuntimeComponentCXClass.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace TestRuntimeComponentCX
4 | {
5 | public ref class TestRuntimeComponentCXClass sealed
6 | {
7 | public:
8 | TestRuntimeComponentCXClass();
9 |
10 | void Test();
11 | };
12 | }
13 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentCX/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentCX/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/CxClass.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "CxClass.h"
3 |
4 | using namespace TestRuntimeComponentCXLibrary;
5 | using namespace Platform;
6 |
7 | CxClass::CxClass(TestStaticLibrary7Class^ c)
8 | {
9 | c->Test();
10 | }
11 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/CxClass.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace TestRuntimeComponentCXLibrary
4 | {
5 | public ref class CxClass sealed
6 | {
7 | public:
8 | CxClass(TestStaticLibrary7Class^ c);
9 | };
10 | }
11 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/TestRuntimeComponentCXReferencingWinRTStaticLibrary.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 33c7d878-02cf-43df-95d8-793bec934cba
6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentEmpty/PropertySheet.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentEmpty/TestRuntimeComponentEmpty.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE
3 | DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE
4 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentEmpty/TestRuntimeComponentEmpty.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | accd3aa8-1ba0-4223-9bbe-0c431709210b
6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
7 |
8 |
9 | {926ab91d-31b4-48c3-b9a4-e681349f27f0}
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentEmpty/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentEmpty/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentNamespaceUnderscore/PropertySheet.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentNamespaceUnderscore/TestRuntimeComponentNamespaceUnderscore.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE
3 | DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE
4 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentNamespaceUnderscore/TestRuntimeComponentNamespaceUnderscoreClass.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "TestRuntimeComponentNamespaceUnderscoreClass.h"
3 | #include "TestRuntimeComponentNamespaceUnderscoreClass.g.cpp"
4 |
5 | namespace winrt::TestRuntimeComponent_NamespaceUnderscore::implementation
6 | {
7 | void TestRuntimeComponentNamespaceUnderscoreClass::Test()
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentNamespaceUnderscore/TestRuntimeComponentNamespaceUnderscoreClass.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "TestRuntimeComponentNamespaceUnderscoreClass.g.h"
4 |
5 | namespace winrt::TestRuntimeComponent_NamespaceUnderscore::implementation
6 | {
7 | struct TestRuntimeComponentNamespaceUnderscoreClass : TestRuntimeComponentNamespaceUnderscoreClassT
8 | {
9 | TestRuntimeComponentNamespaceUnderscoreClass() = default;
10 |
11 | void Test();
12 | };
13 | }
14 |
15 | namespace winrt::TestRuntimeComponent_NamespaceUnderscore::factory_implementation
16 | {
17 | struct TestRuntimeComponentNamespaceUnderscoreClass : TestRuntimeComponentNamespaceUnderscoreClassT
18 | {
19 | };
20 | }
21 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentNamespaceUnderscore/TestRuntimeComponentNamespaceUnderscoreClass.idl:
--------------------------------------------------------------------------------
1 | namespace TestRuntimeComponent_NamespaceUnderscore
2 | {
3 | [default_interface]
4 | runtimeclass TestRuntimeComponentNamespaceUnderscoreClass
5 | {
6 | TestRuntimeComponentNamespaceUnderscoreClass();
7 |
8 | void Test();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentNamespaceUnderscore/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/test/nuget/TestRuntimeComponentNamespaceUnderscore/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | #include
5 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary1/TestStaticLibrary1.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary1/TestStaticLibrary1Class.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "TestStaticLibrary1Class.h"
3 | #include "TestStaticLibrary1Class.g.cpp"
4 |
5 | using namespace winrt::TestApp::Library4;
6 |
7 | namespace winrt::TestApp::Library1::implementation
8 | {
9 | void TestStaticLibrary1Class::Test(TestStaticLibrary4Class const& c)
10 | {
11 | c.Test();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary1/TestStaticLibrary1Class.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "TestStaticLibrary1Class.g.h"
3 |
4 | namespace winrt::TestApp::Library1::implementation
5 | {
6 | struct TestStaticLibrary1Class : TestStaticLibrary1ClassT
7 | {
8 | TestStaticLibrary1Class() = default;
9 |
10 | void Test(TestApp::Library4::TestStaticLibrary4Class const& c);
11 | };
12 | }
13 | namespace winrt::TestApp::Library1::factory_implementation
14 | {
15 | struct TestStaticLibrary1Class : TestStaticLibrary1ClassT
16 | {
17 | };
18 | }
19 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary1/TestStaticLibrary1Class.idl:
--------------------------------------------------------------------------------
1 | namespace TestApp.Library1
2 | {
3 | [default_interface]
4 | runtimeclass TestStaticLibrary1Class
5 | {
6 | TestStaticLibrary1Class();
7 |
8 | void Test(TestApp.Library4.TestStaticLibrary4Class c);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary1/pch.cpp:
--------------------------------------------------------------------------------
1 | // pch.cpp: source file corresponding to the pre-compiled header
2 |
3 | #include "pch.h"
4 |
5 | // When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
6 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary1/pch.h:
--------------------------------------------------------------------------------
1 | //
2 | // pch.h
3 | // Header for platform projection include files
4 | //
5 |
6 | #pragma once
7 |
8 | #define WIN32_LEAN_AND_MEAN
9 |
10 | #include "winrt/TestApp.Library4.h"
11 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary2/TestStaticLibrary2.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary2/TestStaticLibrary2Class.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "TestStaticLibrary2Class.h"
3 | #include "TestStaticLibrary2Class.g.cpp"
4 |
5 | using namespace winrt::TestRuntimeComponent3;
6 |
7 | namespace winrt::TestRuntimeComponent2::implementation
8 | {
9 | void TestStaticLibrary2Class::Test()
10 | {
11 | TestRuntimeComponent3Class c{};
12 | c.Test();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary2/TestStaticLibrary2Class.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "TestStaticLibrary2Class.g.h"
3 |
4 | namespace winrt::TestRuntimeComponent2::implementation
5 | {
6 | struct TestStaticLibrary2Class : TestStaticLibrary2ClassT
7 | {
8 | TestStaticLibrary2Class() = default;
9 |
10 | void Test();
11 | };
12 | }
13 | namespace winrt::TestRuntimeComponent2::factory_implementation
14 | {
15 | struct TestStaticLibrary2Class : TestStaticLibrary2ClassT
16 | {
17 | };
18 | }
19 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary2/TestStaticLibrary2Class.idl:
--------------------------------------------------------------------------------
1 | namespace TestRuntimeComponent2
2 | {
3 | [default_interface]
4 | runtimeclass TestStaticLibrary2Class
5 | {
6 | TestStaticLibrary2Class();
7 |
8 | void Test();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary2/pch.cpp:
--------------------------------------------------------------------------------
1 | // pch.cpp: source file corresponding to the pre-compiled header
2 |
3 | #include "pch.h"
4 |
5 | // When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
6 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary2/pch.h:
--------------------------------------------------------------------------------
1 | //
2 | // pch.h
3 | // Header for platform projection include files
4 | //
5 |
6 | #pragma once
7 |
8 | #define WIN32_LEAN_AND_MEAN
9 |
10 | #include "winrt/TestRuntimeComponent3.h"
11 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary3/TestStaticLibrary3.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary3/TestStaticLibrary3Class.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "TestStaticLibrary3Class.h"
3 | #include "TestStaticLibrary3Class.g.cpp"
4 |
5 | namespace winrt::TestRuntimeComponent3::implementation
6 | {
7 | void TestStaticLibrary3Class::Test()
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary3/TestStaticLibrary3Class.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "TestStaticLibrary3Class.g.h"
3 |
4 | namespace winrt::TestRuntimeComponent3::implementation
5 | {
6 | struct TestStaticLibrary3Class : TestStaticLibrary3ClassT
7 | {
8 | TestStaticLibrary3Class() = default;
9 |
10 | void Test();
11 | };
12 | }
13 | namespace winrt::TestRuntimeComponent3::factory_implementation
14 | {
15 | struct TestStaticLibrary3Class : TestStaticLibrary3ClassT
16 | {
17 | };
18 | }
19 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary3/TestStaticLibrary3Class.idl:
--------------------------------------------------------------------------------
1 | namespace TestRuntimeComponent3
2 | {
3 | [default_interface]
4 | runtimeclass TestStaticLibrary3Class
5 | {
6 | TestStaticLibrary3Class();
7 |
8 | void Test();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary3/pch.cpp:
--------------------------------------------------------------------------------
1 | // pch.cpp: source file corresponding to the pre-compiled header
2 |
3 | #include "pch.h"
4 |
5 | // When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
6 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary3/pch.h:
--------------------------------------------------------------------------------
1 | //
2 | // pch.h
3 | // Header for platform projection include files
4 | //
5 |
6 | #pragma once
7 |
8 | #define WIN32_LEAN_AND_MEAN
9 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary4/TestStaticLibrary4.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary4/TestStaticLibrary4Class.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "TestStaticLibrary4Class.h"
3 | #if __has_include("TestStaticLibrary4Class.g.cpp")
4 | #include "TestStaticLibrary4Class.g.cpp"
5 | #endif
6 |
7 | using namespace winrt;
8 | using namespace winrt::Windows::UI::Xaml::Core::Direct;
9 |
10 | namespace winrt::TestApp::Library4::implementation
11 | {
12 | XamlDirect TestStaticLibrary4Class::Test()
13 | {
14 | return XamlDirect::GetDefault();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary4/TestStaticLibrary4Class.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "TestStaticLibrary4Class.g.h"
4 |
5 | namespace winrt::TestApp::Library4::implementation
6 | {
7 | struct TestStaticLibrary4Class : TestStaticLibrary4ClassT
8 | {
9 | TestStaticLibrary4Class() = default;
10 |
11 | Windows::UI::Xaml::Core::Direct::XamlDirect Test();
12 | };
13 | }
14 |
15 | namespace winrt::TestApp::Library4::factory_implementation
16 | {
17 | struct TestStaticLibrary4Class : TestStaticLibrary4ClassT
18 | {
19 | };
20 | }
21 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary4/TestStaticLibrary4Class.idl:
--------------------------------------------------------------------------------
1 | namespace TestApp.Library4
2 | {
3 | [default_interface]
4 | runtimeclass TestStaticLibrary4Class
5 | {
6 | TestStaticLibrary4Class();
7 |
8 | Windows.UI.Xaml.Core.Direct.XamlDirect Test();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary4/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary4/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "targetver.h"
4 |
5 | #ifndef WIN32_LEAN_AND_MEAN
6 | #define WIN32_LEAN_AND_MEAN
7 | #endif
8 |
9 | #include
10 | #include
11 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary4/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // Including SDKDDKVer.h defines the highest available Windows platform.
4 |
5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary5/TestStaticLibrary5.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary5/TestStaticLibrary5Class.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "TestStaticLibrary5Class.h"
3 | #if __has_include("TestStaticLibrary5Class.g.cpp")
4 | #include "TestStaticLibrary5Class.g.cpp"
5 | #endif
6 |
7 | using namespace winrt;
8 | using namespace winrt::Windows::UI::Xaml::Core::Direct;
9 |
10 | namespace winrt::TestRuntimeComponentEmpty::implementation
11 | {
12 | XamlDirect TestStaticLibrary5Class::Test()
13 | {
14 | return XamlDirect::GetDefault();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary5/TestStaticLibrary5Class.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "TestStaticLibrary5Class.g.h"
4 |
5 | namespace winrt::TestRuntimeComponentEmpty::implementation
6 | {
7 | struct TestStaticLibrary5Class : TestStaticLibrary5ClassT
8 | {
9 | TestStaticLibrary5Class() = default;
10 |
11 | Windows::UI::Xaml::Core::Direct::XamlDirect Test();
12 | };
13 | }
14 |
15 | namespace winrt::TestRuntimeComponentEmpty::factory_implementation
16 | {
17 | struct TestStaticLibrary5Class : TestStaticLibrary5ClassT
18 | {
19 | };
20 | }
21 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary5/TestStaticLibrary5Class.idl:
--------------------------------------------------------------------------------
1 | namespace TestRuntimeComponentEmpty
2 | {
3 | [default_interface]
4 | runtimeclass TestStaticLibrary5Class
5 | {
6 | TestStaticLibrary5Class();
7 |
8 | Windows.UI.Xaml.Core.Direct.XamlDirect Test();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary5/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary5/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "targetver.h"
4 |
5 | #ifndef WIN32_LEAN_AND_MEAN
6 | #define WIN32_LEAN_AND_MEAN
7 | #endif
8 |
9 | #include
10 | #include
11 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary5/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // Including SDKDDKVer.h defines the highest available Windows platform.
4 |
5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary6/TestNamespace.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "TestNamespace.h"
3 | #if __has_include("TestRuntimeComponentNamespace.TestNamespace.g.cpp")
4 | #include "TestRuntimeComponentNamespace.TestNamespace.g.cpp"
5 | #endif
6 |
7 | using namespace winrt;
8 |
9 | namespace winrt::TestRuntimeComponentNamespace::implementation
10 | {
11 | }
12 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary6/TestNamespace.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "TestRuntimeComponentNamespace.TestNamespace.g.h"
4 |
5 | namespace winrt::TestRuntimeComponentNamespace::implementation
6 | {
7 | struct TestNamespace : TestNamespaceT
8 | {
9 | TestNamespace() = default;
10 | };
11 | }
12 |
13 | namespace winrt::TestRuntimeComponentNamespace::factory_implementation
14 | {
15 | struct TestNamespace : TestNamespaceT
16 | {
17 | };
18 | }
19 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary6/TestNamespace.idl:
--------------------------------------------------------------------------------
1 | namespace TestRuntimeComponentNamespace
2 | {
3 | [bindable]
4 | [default_interface]
5 | runtimeclass TestNamespace
6 | {
7 | TestNamespace();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary6/TestStaticLibrary6.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary6/TestStaticLibrary6Class.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "TestStaticLibrary6Class.h"
3 | #if __has_include("SubNamespace1.TestStaticLibrary6Class.g.cpp")
4 | #include "SubNamespace1.TestStaticLibrary6Class.g.cpp"
5 | #endif
6 |
7 | using namespace winrt;
8 | using namespace winrt::Windows::UI::Xaml::Core::Direct;
9 |
10 | namespace winrt::TestRuntimeComponentEmpty::SubNamespace1::implementation
11 | {
12 | XamlDirect TestStaticLibrary6Class::Test()
13 | {
14 | return XamlDirect::GetDefault();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary6/TestStaticLibrary6Class.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "SubNamespace1.TestStaticLibrary6Class.g.h"
4 |
5 | namespace winrt::TestRuntimeComponentEmpty::SubNamespace1::implementation
6 | {
7 | struct TestStaticLibrary6Class : TestStaticLibrary6ClassT
8 | {
9 | TestStaticLibrary6Class() = default;
10 |
11 | Windows::UI::Xaml::Core::Direct::XamlDirect Test();
12 | };
13 | }
14 |
15 | namespace winrt::TestRuntimeComponentEmpty::SubNamespace1::factory_implementation
16 | {
17 | struct TestStaticLibrary6Class : TestStaticLibrary6ClassT
18 | {
19 | };
20 | }
21 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary6/TestStaticLibrary6Class.idl:
--------------------------------------------------------------------------------
1 | namespace TestRuntimeComponentEmpty.SubNamespace1
2 | {
3 | [default_interface]
4 | runtimeclass TestStaticLibrary6Class
5 | {
6 | TestStaticLibrary6Class();
7 |
8 | Windows.UI.Xaml.Core.Direct.XamlDirect Test();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary6/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary6/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "targetver.h"
4 |
5 | #ifndef WIN32_LEAN_AND_MEAN
6 | #define WIN32_LEAN_AND_MEAN
7 | #endif
8 |
9 | #include
10 | #include
11 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary6/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // Including SDKDDKVer.h defines the highest available Windows platform.
4 |
5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary7/PropertySheet.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary7/TestStaticLibrary7.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | accd3aa8-1ba0-4223-9bbe-0c431709210b
6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
7 |
8 |
9 | {926ab91d-31b4-48c3-b9a4-e681349f27f0}
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary7/TestStaticLibrary7Class.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "TestStaticLibrary7Class.h"
3 | #include "TestStaticLibrary7Class.g.cpp"
4 |
5 | using namespace winrt;
6 | using namespace winrt::Windows::UI::Xaml::Core::Direct;
7 |
8 | namespace winrt::TestRuntimeComponentCXLibrary::implementation
9 | {
10 | XamlDirect TestStaticLibrary7Class::Test()
11 | {
12 | return XamlDirect::GetDefault();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary7/TestStaticLibrary7Class.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "TestStaticLibrary7Class.g.h"
4 |
5 | namespace winrt::TestRuntimeComponentCXLibrary::implementation
6 | {
7 | struct TestStaticLibrary7Class : TestStaticLibrary7ClassT
8 | {
9 | TestStaticLibrary7Class() = default;
10 |
11 | Windows::UI::Xaml::Core::Direct::XamlDirect Test();
12 | };
13 | }
14 |
15 | namespace winrt::TestRuntimeComponentCXLibrary::factory_implementation
16 | {
17 | struct TestStaticLibrary7Class : TestStaticLibrary7ClassT
18 | {
19 | };
20 | }
21 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary7/TestStaticLibrary7Class.idl:
--------------------------------------------------------------------------------
1 | namespace TestRuntimeComponentCXLibrary
2 | {
3 | [default_interface]
4 | runtimeclass TestStaticLibrary7Class
5 | {
6 | TestStaticLibrary7Class();
7 |
8 | Windows.UI.Xaml.Core.Direct.XamlDirect Test();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary7/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/test/nuget/TestStaticLibrary7/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | #include
5 |
6 | #include
7 |
--------------------------------------------------------------------------------
/test/old_tests/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(UnitTests)
2 |
--------------------------------------------------------------------------------
/test/old_tests/Component/CustomBase.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "CustomBase.h"
3 |
4 | namespace winrt::Component::implementation
5 | {
6 | hstring CustomBase::CustomVirtualMethod()
7 | {
8 | return L"CustomBase";
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/old_tests/Component/CustomBase.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "CustomBase.g.h"
4 |
5 | namespace winrt::Component::implementation
6 | {
7 | struct CustomBase : CustomBaseT
8 | {
9 | CustomBase()
10 | : base_type(L"CustomBase")
11 | {}
12 |
13 | virtual hstring CustomVirtualMethod();
14 |
15 | void TryAsBase()
16 | {
17 | // Try querying an interface that doesn't inherit from Windows::Foundation::IInspectable, to force a com_ptr return type
18 | using target = impl::IWeakReferenceSource;
19 | static_assert(std::is_same_v, com_ptr>);
20 | this->try_as();
21 | }
22 | };
23 | }
24 |
25 | namespace winrt::Component::factory_implementation
26 | {
27 | struct CustomBase : CustomBaseT
28 | {
29 | };
30 | }
31 |
--------------------------------------------------------------------------------
/test/old_tests/Component/Errors.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "Errors.h"
3 |
4 | namespace winrt::Component::implementation
5 | {
6 | using namespace Windows::Foundation;
7 |
8 | void Errors::Fail(hstring const& message)
9 | {
10 | throw hresult_not_implemented(message);
11 | }
12 |
13 | void Errors::Propagate()
14 | {
15 | Uri(L"BAD");
16 | }
17 |
18 | void Errors::std_bad_alloc()
19 | {
20 | throw std::bad_alloc();
21 | }
22 |
23 | void Errors::std_out_of_range()
24 | {
25 | throw std::out_of_range("std_out_of_range");
26 | }
27 |
28 | void Errors::std_invalid_argument()
29 | {
30 | throw std::invalid_argument("std_invalid_argument");
31 | }
32 |
33 | void Errors::std_exception()
34 | {
35 | // Some unsupported exception that is still rooted in std::exception.
36 | throw std::range_error("std_exception");
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/test/old_tests/Component/Errors.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "Errors.g.h"
4 |
5 | namespace winrt::Component::implementation
6 | {
7 | struct Errors : ErrorsT
8 | {
9 | Errors() = default;
10 |
11 | void Fail(hstring const& message);
12 | void Propagate();
13 |
14 | void std_bad_alloc();
15 | void std_out_of_range();
16 | void std_invalid_argument();
17 | void std_exception();
18 | };
19 | }
20 |
21 | namespace winrt::Component::factory_implementation
22 | {
23 | struct Errors : ErrorsT
24 | {
25 | };
26 | }
27 |
--------------------------------------------------------------------------------
/test/old_tests/Component/FastInputMap.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "FastInputMap.h"
3 |
4 | namespace winrt::Component::implementation
5 | {
6 | using namespace Windows::Foundation::Collections;
7 |
8 | FastInputMap::FastInputMap(IMapView const& in)
9 | {
10 | for (auto&& pair : in)
11 | {
12 | m_container[pair.Key()] = pair.Value();
13 | }
14 | }
15 |
16 | void FastInputMap::Close()
17 | {
18 | throw hresult_not_implemented();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/test/old_tests/Component/FastInputMap.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "FastInputMap.g.h"
4 |
5 | namespace winrt::Component::implementation
6 | {
7 | struct FastInputMap :
8 | FastInputMapT,
9 | map_base
10 | {
11 | FastInputMap(Windows::Foundation::Collections::IMapView const& in);
12 | void Close();
13 |
14 | auto& get_container() const noexcept
15 | {
16 | return m_container;
17 | }
18 |
19 | auto& get_container() noexcept
20 | {
21 | return m_container;
22 | }
23 |
24 | private:
25 |
26 | std::map m_container;
27 | };
28 | }
29 |
30 | namespace winrt::Component::factory_implementation
31 | {
32 | struct FastInputMap : FastInputMapT
33 | {
34 | };
35 | }
36 |
--------------------------------------------------------------------------------
/test/old_tests/Component/FastInputVector.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "FastInputVector.h"
3 |
4 | namespace winrt::Component::implementation
5 | {
6 | using namespace Windows::Foundation::Collections;
7 |
8 | FastInputVector::FastInputVector(IVectorView const& in) :
9 | m_container(begin(in), end(in))
10 | {
11 | }
12 |
13 | void FastInputVector::Close()
14 | {
15 | throw hresult_not_implemented();
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/test/old_tests/Component/FastInputVector.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "FastInputVector.g.h"
4 |
5 | namespace winrt::Component::implementation
6 | {
7 | struct FastInputVector :
8 | FastInputVectorT,
9 | vector_base
10 | {
11 | FastInputVector(Windows::Foundation::Collections::IVectorView const& in);
12 | void Close();
13 |
14 | auto& get_container() const noexcept
15 | {
16 | return m_container;
17 | }
18 |
19 | auto& get_container() noexcept
20 | {
21 | return m_container;
22 | }
23 |
24 | private:
25 |
26 | std::vector m_container;
27 | };
28 | }
29 |
30 | namespace winrt::Component::factory_implementation
31 | {
32 | struct FastInputVector : FastInputVectorT
33 | {
34 | };
35 | }
36 |
--------------------------------------------------------------------------------
/test/old_tests/Component/NonCachedStatic.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "NonCachedStatic.h"
3 |
--------------------------------------------------------------------------------
/test/old_tests/Component/NonCachedStatic.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "NonCachedStatic.g.h"
4 |
5 | namespace winrt::Component::factory_implementation
6 | {
7 | struct NonCachedStatic : NonCachedStaticT
8 | {
9 | winrt::event_token StaticEvent(Windows::Foundation::EventHandler const& handler)
10 | {
11 | return m_static.add(handler);
12 | }
13 |
14 | void StaticEvent(winrt::event_token const& cookie)
15 | {
16 | m_static.remove(cookie);
17 | }
18 |
19 | void RaiseStaticEvent(int32_t value)
20 | {
21 | m_static(nullptr, value);
22 | }
23 |
24 | event> m_static;
25 | };
26 | }
27 |
--------------------------------------------------------------------------------
/test/old_tests/Component/Static.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "Static.h"
3 |
--------------------------------------------------------------------------------
/test/old_tests/Component/Static.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "Static.g.h"
4 |
5 | namespace winrt::Component::implementation
6 | {
7 | struct Static
8 | {
9 | Static() = delete;
10 | };
11 | }
12 |
13 | namespace winrt::Component::factory_implementation
14 | {
15 | struct Static : StaticT
16 | {
17 | winrt::event_token StaticEvent(Windows::Foundation::EventHandler const& handler)
18 | {
19 | return m_static.add(handler);
20 | }
21 |
22 | void StaticEvent(winrt::event_token const& cookie)
23 | {
24 | m_static.remove(cookie);
25 | }
26 |
27 | void RaiseStaticEvent(int32_t value)
28 | {
29 | m_static(nullptr, value);
30 | }
31 |
32 | event> m_static;
33 | };
34 | }
35 |
--------------------------------------------------------------------------------
/test/old_tests/Component/Structures.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "Structures.g.h"
4 |
5 | namespace winrt::Component::implementation
6 | {
7 | struct Structures : StructuresT
8 | {
9 | Structures() = default;
10 |
11 | void Set(WrapStructure const& value);
12 | WrapStructure Get();
13 | void Out(WrapStructure& value);
14 | void Ref(WrapStructure const& value);
15 | void SetArray(array_view value);
16 | com_array GetArray();
17 | void OutArray(com_array& value);
18 | void CopyArray(array_view value);
19 |
20 | private:
21 | WrapStructure m_value;
22 | std::vector m_array;
23 | };
24 | }
25 |
26 | namespace winrt::Component::factory_implementation
27 | {
28 | struct Structures : StructuresT
29 | {
30 | };
31 | }
32 |
--------------------------------------------------------------------------------
/test/old_tests/Component/module.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE
3 | DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE
4 |
--------------------------------------------------------------------------------
/test/old_tests/Component/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/test/old_tests/Component/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifdef _MSC_VER
4 | #pragma warning(disable:4100)
5 | #endif
6 |
7 | #include "winrt/Windows.Foundation.Collections.h"
8 | #include "winrt/Composable.h"
9 |
10 | // This is used to validate WRL interop support.
11 | #pragma warning(push)
12 | #pragma warning(disable: 4324) // structure was padded due to alignment specifier
13 | #include
14 | #pragma warning(pop)
--------------------------------------------------------------------------------
/test/old_tests/Composable/Base.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "Base.g.h"
4 |
5 | namespace winrt::Composable::implementation
6 | {
7 | struct Base : BaseT
8 | {
9 | Base() = default;
10 | explicit Base(const hstring& name)
11 | : m_name(name)
12 | {}
13 |
14 | virtual hstring VirtualMethod();
15 | hstring CallOverridableMethod();
16 | hstring CallOverridableVirtualMethod();
17 | int32_t CallOverridableNoexceptMethod() noexcept;
18 | hstring OverridableMethod() ;
19 | virtual hstring OverridableVirtualMethod();
20 | int32_t OverridableNoexceptMethod() noexcept;
21 | int32_t ProtectedMethod();
22 |
23 | hstring Name() const;
24 |
25 | private:
26 | hstring m_name;
27 | };
28 | }
29 |
30 | namespace winrt::Composable::factory_implementation
31 | {
32 | struct Base : BaseT
33 | {
34 | };
35 | }
36 |
--------------------------------------------------------------------------------
/test/old_tests/Composable/Composable.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {7d1d3582-efe3-43de-baaa-895c81a28814}
6 |
7 |
8 |
9 |
10 | Generated Files
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/test/old_tests/Composable/Derived.cpp:
--------------------------------------------------------------------------------
1 | #include "precomp.hpp"
2 | #include "Derived.h"
3 |
4 | namespace winrt::Composable::implementation
5 | {
6 | hstring Derived::VirtualMethod()
7 | {
8 | return L"Derived::VirtualMethod";
9 | }
10 |
11 | hstring Derived::OverridableVirtualMethod()
12 | {
13 | return L"Derived::OverridableVirtualMethod";
14 | }
15 |
16 | int32_t Derived::CallProtectedMethod()
17 | {
18 | return ProtectedMethod();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/test/old_tests/Composable/Derived.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "Derived.g.h"
4 | #include "Base.h"
5 |
6 | namespace winrt::Composable::implementation
7 | {
8 | struct Derived : DerivedT
9 | {
10 | Derived() = default;
11 | explicit Derived(const hstring& name)
12 | : base_type(name)
13 | {}
14 |
15 | hstring VirtualMethod() override;
16 | hstring OverridableVirtualMethod() override;
17 | int32_t CallProtectedMethod();
18 | };
19 | }
20 |
21 | namespace winrt::Composable::factory_implementation
22 | {
23 | struct Derived : DerivedT
24 | {
25 | };
26 | }
27 |
--------------------------------------------------------------------------------
/test/old_tests/Composable/module.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE
3 | DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE
4 |
--------------------------------------------------------------------------------
/test/old_tests/Composable/precomp.cpp:
--------------------------------------------------------------------------------
1 | #include "precomp.hpp"
2 |
--------------------------------------------------------------------------------
/test/old_tests/Composable/precomp.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifdef _MSC_VER
4 | #pragma warning(disable:4100)
5 | #endif
6 |
7 | #include "winrt/Windows.Foundation.h"
8 | #include "winrt/Composable.h"
9 |
--------------------------------------------------------------------------------
/test/old_tests/UnitTests/Generics.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "catch.hpp"
3 |
4 | using namespace winrt;
5 | using namespace Windows::Foundation;
6 | using namespace Windows::Foundation::Collections;
7 |
8 | TEST_CASE("Generics")
9 | {
10 | bool a = name_of>() == L"Windows.Foundation.EventHandler`1";
11 | bool b = name_of>() == L"Windows.Foundation.TypedEventHandler`2";
12 |
13 | REQUIRE(a);
14 | REQUIRE(b);
15 | }
16 |
--------------------------------------------------------------------------------
/test/old_tests/UnitTests/IUnknown_QueryInterface.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "catch.hpp"
3 |
4 | using namespace winrt;
5 | using namespace Windows::Foundation;
6 |
7 | //
8 | // These tests cover the behaviour of the 'as' and 'try_as' members that provide the
9 | // projection's access to IUnknown's QueryInterface virtual function. Both the
10 | // projected IUnknown (value type) and the com_ptr class template provide both 'as'
11 | // and 'try_as' and while those types are different, these two methods should behave
12 | // the same way.
13 | //
14 |
15 | TEST_CASE("IUnknown::as,try_as")
16 | {
17 | Uri uri(L"http://host/path");
18 |
19 | {
20 | IUriRuntimeClass p = uri.as();
21 | REQUIRE(p);
22 |
23 | IStringable s = uri.as();
24 | REQUIRE(s);
25 |
26 | REQUIRE_THROWS_AS(uri.as(), hresult_no_interface);
27 |
28 | IClosable c = uri.try_as();
29 | REQUIRE(!c);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/test/old_tests/UnitTests/References.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "catch.hpp"
3 |
4 | using namespace winrt;
5 | using namespace Windows::Foundation;
6 |
7 | TEST_CASE("References")
8 | {
9 | // Confirms equality for IReference works as expected.
10 |
11 | IReference a{ 123 };
12 | IReference b{ a };
13 | IReference c{ 123 };
14 | IReference d{ 321 };
15 | IReference e{ nullptr };
16 |
17 | // The underlying IReference is the same so the comparison
18 | // uses get_abi under the hood.
19 | REQUIRE(a == b);
20 |
21 | // In this case, it's a different IReference but it still compares
22 | // correctly by value.
23 | REQUIRE(a == c);
24 |
25 | // Both valid but different values.
26 | REQUIRE(a != d);
27 |
28 | // Tests short circuit when one is empty.
29 | REQUIRE(a != e);
30 | }
31 |
--------------------------------------------------------------------------------
/test/old_tests/UnitTests/buffer.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "catch.hpp"
3 |
4 | using namespace winrt;
5 | using namespace Windows::Storage::Streams;
6 |
7 | TEST_CASE("buffer")
8 | {
9 | Buffer buffer{ 3 };
10 | uint8_t* ptr = buffer.data();
11 | ptr[0] = 1;
12 | ptr[1] = 2;
13 | ptr[2] = 3;
14 | REQUIRE(ptr != nullptr);
15 | REQUIRE(buffer.Capacity() == 3);
16 | REQUIRE(buffer.Length() == 0);
17 | buffer.Length(3);
18 | REQUIRE(buffer.Length() == 3);
19 | }
20 |
--------------------------------------------------------------------------------
/test/old_tests/UnitTests/char16.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "catch.hpp"
3 |
4 | using namespace winrt;
5 | using namespace Windows::Foundation;
6 |
7 | TEST_CASE("char16_t")
8 | {
9 | IReference ref = L'Q';
10 |
11 | Windows::Foundation::IInspectable in = ref;
12 |
13 | IReference ref2 = in.as>();
14 |
15 | char16_t w = ref2.Value();
16 |
17 | REQUIRE(w == L'Q');
18 | }
19 |
--------------------------------------------------------------------------------
/test/old_tests/UnitTests/create_instance.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "catch.hpp"
3 | #include
4 |
5 | using namespace winrt;
6 |
7 | TEST_CASE("create_instance")
8 | {
9 | com_ptr dialog = create_instance(guid_of());
10 | REQUIRE(dialog);
11 | }
12 |
13 | TEST_CASE("try_create_instance")
14 | {
15 | com_ptr dialog = try_create_instance(guid_of());
16 | REQUIRE(dialog);
17 |
18 | dialog = try_create_instance(CLSID_NULL);
19 | REQUIRE(!dialog);
20 | }
21 |
--------------------------------------------------------------------------------
/test/old_tests/UnitTests/hstring_builder.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "catch.hpp"
3 |
4 | using namespace winrt;
5 |
6 | TEST_CASE("hstring_builder")
7 | {
8 | impl::hstring_builder discard(3);
9 |
10 | impl::hstring_builder builder(3);
11 |
12 | wcscpy_s(builder.data(), 4, L"abc");
13 |
14 | hstring string = builder.to_hstring();
15 |
16 | REQUIRE(string == L"abc");
17 | }
18 |
--------------------------------------------------------------------------------
/test/old_tests/UnitTests/lock.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "catch.hpp"
3 |
4 | using namespace winrt;
5 |
6 | TEST_CASE("slim_mutex coverage")
7 | {
8 | slim_mutex m;
9 | m.lock();
10 | m.unlock();
11 |
12 | m.lock_shared();
13 | m.unlock_shared();
14 |
15 | REQUIRE(m.try_lock());
16 | m.unlock();
17 |
18 | REQUIRE(m.try_lock_shared());
19 | m.unlock_shared();
20 | }
21 |
--------------------------------------------------------------------------------
/test/old_tests/UnitTests/param_hstring.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "catch.hpp"
3 |
4 | using namespace winrt;
5 |
6 | namespace
7 | {
8 | hstring inner(param::hstring const& value)
9 | {
10 | hstring result;
11 | copy_from_abi(result, get_abi(value));
12 | return L"[" + result + L"]";
13 | }
14 |
15 | hstring outer(param::hstring const& value)
16 | {
17 | // This is a typical scenario in the projection where an instance method
18 | // calls a factory method. The param::hstring doesn't allow copy semantics
19 | // and we want to make sure this is efficient (and works).
20 |
21 | return inner(value);
22 | }
23 | }
24 |
25 | TEST_CASE("param_hstring")
26 | {
27 | REQUIRE(outer({}) == L"[]");
28 | REQUIRE(outer(L"literal") == L"[literal]");
29 |
30 | hstring winrt_hstring = L"winrt::hstring";
31 | REQUIRE(outer(winrt_hstring) == L"[winrt::hstring]");
32 |
33 | std::wstring std_wstring = L"std::wstring";
34 | REQUIRE(outer(std_wstring) == L"[std::wstring]");
35 |
36 | std::wstring_view std_wstring_view = L"std::wstring_view";
37 | REQUIRE(outer(std_wstring_view) == L"[std::wstring_view]");
38 | }
39 |
--------------------------------------------------------------------------------
/test/old_tests/UnitTests/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
3 | HRESULT winrt_test_terminate_hresult = S_OK;
4 |
--------------------------------------------------------------------------------
/test/old_tests/UnitTests/sdk.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
3 |
4 | static_assert(sizeof(SLIST_ENTRY) == sizeof(winrt::impl::slist_entry));
5 | static_assert(std::alignment_of_v == std::alignment_of_v);
6 |
7 | static_assert(sizeof(SLIST_HEADER) == sizeof(winrt::impl::slist_header));
8 | static_assert(std::alignment_of_v == std::alignment_of_v);
9 |
10 | static_assert(MEMORY_ALLOCATION_ALIGNMENT == winrt::impl::memory_allocation_alignment);
--------------------------------------------------------------------------------
/test/old_tests/UnitTests/streams.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "catch.hpp"
3 | #include
4 |
5 | struct stringable : winrt::implements
6 | {
7 | winrt::hstring ToString()
8 | {
9 | return L"a stringable object";
10 | }
11 | };
12 |
13 | TEST_CASE("streams")
14 | {
15 | {
16 | std::wstringstream ss;
17 | winrt::hstring str = L"Hello World";
18 | ss << str;
19 | REQUIRE(ss.str() == str);
20 | }
21 |
22 | {
23 | // Support embedded nulls.
24 | std::wstringstream ss;
25 | winrt::hstring str = L"Hello\0World";
26 | ss << str;
27 | REQUIRE(ss.str() == str);
28 | }
29 |
30 | {
31 | std::wstringstream ss;
32 | winrt::Windows::Foundation::IStringable obj = winrt::make();
33 | ss << obj;
34 | REQUIRE(ss.str() == obj.ToString());
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/test/old_tests/UnitTests/string_view_compare.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | template
6 | inline constexpr bool string_view_equal(std::basic_string_view left, std::basic_string_view right) noexcept
7 | {
8 | if (left.size() != right.size())
9 | {
10 | return false;
11 | }
12 |
13 | for (size_t i = 0; i < left.size(); ++i)
14 | {
15 | if (left[i] != right[i])
16 | {
17 | return false;
18 | }
19 | }
20 |
21 | return true;
22 | }
23 |
--------------------------------------------------------------------------------
/test/test/box_delegate.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
3 | TEST_CASE("box_delegate")
4 | {
5 | using Handler = winrt::Windows::Foundation::TypedEventHandler;
6 |
7 | Handler d = [](auto&&...) {};
8 | REQUIRE(d);
9 |
10 | auto box = winrt::box_value(d);
11 |
12 | Handler unbox = winrt::unbox_value(box);
13 | REQUIRE(winrt::get_abi(unbox) == winrt::get_abi(d));
14 |
15 | unbox = winrt::unbox_value_or(box, Handler {});
16 | REQUIRE(winrt::get_abi(unbox) == winrt::get_abi(d));
17 |
18 | unbox = winrt::unbox_value_or(winrt::Windows::Foundation::IInspectable{}, Handler{});
19 | REQUIRE(!unbox);
20 | }
21 |
--------------------------------------------------------------------------------
/test/test/box_guid.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
3 | TEST_CASE("box_guid")
4 | {
5 | winrt::guid const winrt_guid = __uuidof(::IUnknown);
6 | GUID const sdk_guid = winrt_guid;
7 |
8 | auto box_a = winrt::box_value(winrt_guid);
9 | auto box_b = winrt::box_value(sdk_guid);
10 |
11 | winrt::guid unbox_a = winrt::unbox_value(box_a);
12 | GUID unbox_b = winrt::unbox_value(box_a);
13 |
14 | REQUIRE(unbox_a == winrt_guid);
15 | REQUIRE(unbox_b == sdk_guid);
16 |
17 | unbox_a = winrt::unbox_value_or(box_a, winrt::guid{});
18 | unbox_b = winrt::unbox_value_or(box_a, GUID{});
19 |
20 | REQUIRE(unbox_a == winrt_guid);
21 | REQUIRE(unbox_b == sdk_guid);
22 | }
23 |
--------------------------------------------------------------------------------
/test/test/coro_foundation.cpp:
--------------------------------------------------------------------------------
1 | // Intentionally not using pch...
2 | #include "catch.hpp"
3 |
4 | // Only need winrt/Windows.Foundation.h for IAsyncXxx coroutine support
5 | #include "winrt/Windows.Foundation.h"
6 |
7 | using namespace winrt;
8 | using namespace Windows::Foundation;
9 |
10 | namespace
11 | {
12 | IAsyncOperation Async()
13 | {
14 | co_return L"hello";
15 | }
16 | }
17 |
18 | TEST_CASE("coro_foundation")
19 | {
20 | REQUIRE(Async().get() == L"hello");
21 | }
22 |
--------------------------------------------------------------------------------
/test/test/coro_system.cpp:
--------------------------------------------------------------------------------
1 | // Intentionally not using pch...
2 | #include "catch.hpp"
3 |
4 | // Only need winrt/Windows.System.h for resume_foreground DispatcherQueue support
5 | #include "winrt/Windows.System.h"
6 |
7 | using namespace winrt;
8 | using namespace Windows::System;
9 |
10 | namespace
11 | {
12 | fire_and_forget Async(DispatcherQueue queue)
13 | {
14 | co_await resume_foreground(queue);
15 |
16 | co_await queue;
17 | }
18 | }
19 |
20 | TEST_CASE("coro_system")
21 | {
22 | auto controller = DispatcherQueueController::CreateOnDedicatedThread();
23 | Async(controller.DispatcherQueue());
24 | }
25 |
--------------------------------------------------------------------------------
/test/test/coro_threadpool.cpp:
--------------------------------------------------------------------------------
1 | // Intentionally not using pch...
2 | #include "catch.hpp"
3 |
4 | // Only need winrt/base.h for coroutine thread pool support.
5 | #include "winrt/base.h"
6 |
7 | using namespace winrt;
8 |
9 | namespace
10 | {
11 | fire_and_forget Async()
12 | {
13 | co_await resume_background();
14 | }
15 | }
16 |
17 | TEST_CASE("coro_base")
18 | {
19 | Async();
20 | }
21 |
--------------------------------------------------------------------------------
/test/test/coro_ui_core.cpp:
--------------------------------------------------------------------------------
1 | // Intentionally not using pch...
2 | #include "catch.hpp"
3 |
4 | // Only need winrt/Windows.UI.Core.h for resume_foreground CoreDispatcher support
5 | #include "winrt/Windows.UI.Core.h"
6 |
7 | using namespace winrt;
8 | using namespace Windows::UI::Core;
9 |
10 | namespace
11 | {
12 | fire_and_forget Async(CoreDispatcher queue, bool test)
13 | {
14 | if (test)
15 | {
16 | co_return;
17 | }
18 |
19 | co_await resume_foreground(queue);
20 |
21 | co_await queue;
22 | }
23 | }
24 |
25 | TEST_CASE("coro_ui_core")
26 | {
27 | Async(nullptr, true);
28 | }
29 |
--------------------------------------------------------------------------------
/test/test/enum.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "winrt/test_component.h"
3 |
4 | using namespace winrt;
5 | using namespace test_component;
6 |
7 | TEST_CASE("enum")
8 | {
9 | STATIC_REQUIRE(std::is_same_v, int32_t>);
10 | STATIC_REQUIRE(std::is_same_v, uint32_t>);
11 |
12 | STATIC_REQUIRE(name_of() == L"test_component.Signed"sv);
13 | STATIC_REQUIRE(name_of() == L"test_component.Unsigned"sv);
14 |
15 | REQUIRE(((Unsigned::First | Unsigned::Second | Unsigned::Third) & Unsigned::Second) == Unsigned::Second);
16 |
17 | REQUIRE(static_cast(Signed::First) == -1);
18 | REQUIRE(static_cast(Signed::Second) == 0);
19 | REQUIRE(static_cast(Signed::Third) == 1);
20 |
21 | REQUIRE(static_cast(Unsigned::First) == 0);
22 | REQUIRE(static_cast(Unsigned::Second) == 1);
23 | REQUIRE(static_cast(Unsigned::Third) == 2);
24 | }
25 |
--------------------------------------------------------------------------------
/test/test/event_clear.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
3 | using namespace winrt;
4 | using namespace Windows::Foundation;
5 |
6 | //
7 | // Checks that clear removes all event handlers
8 | //
9 |
10 | TEST_CASE("event_clear")
11 | {
12 | event> event;
13 | int counter{};
14 |
15 | auto a = event.add([&](auto && ...)
16 | {
17 | counter += 1;
18 | });
19 | (void)a;
20 |
21 | auto b = event.add([&](auto && ...)
22 | {
23 | counter += 10;
24 | });
25 | (void)b;
26 |
27 | REQUIRE(counter == 0);
28 | event(0, 0);
29 | REQUIRE(counter == 11);
30 |
31 | // Clear event
32 | event.clear();
33 |
34 | counter = 0;
35 | event(0, 0);
36 | REQUIRE(counter == 0);
37 | }
38 |
--------------------------------------------------------------------------------
/test/test/generic_types.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "generic_types.h"
3 |
4 | TEST_CASE("generic_types")
5 | {
6 | test_guids();
7 |
8 | REQUIRE_EQUAL_NAME(L"Windows.Foundation.Uri", Uri);
9 | REQUIRE_EQUAL_NAME(L"Windows.Foundation.PropertyType", PropertyType);
10 | REQUIRE_EQUAL_NAME(L"Windows.Foundation.Point", Point);
11 | REQUIRE_EQUAL_NAME(L"Windows.Foundation.IStringable", IStringable);
12 | }
13 |
--------------------------------------------------------------------------------
/test/test/get_activation_factory.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include
3 |
4 | TEST_CASE("get_activation_factory")
5 | {
6 | // Compile-time test to ensure that get_activation_factory supports unprojected factory interfaces.
7 |
8 | auto factory = winrt::get_activation_factory();
9 |
10 | REQUIRE(factory);
11 | }
12 |
--------------------------------------------------------------------------------
/test/test/guid_include.cpp:
--------------------------------------------------------------------------------
1 | #include "winrt/base.h"
2 | #include
3 | #include "winrt/Windows.Foundation.h"
4 |
--------------------------------------------------------------------------------
/test/test/hresult_class_not_registered.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
3 | using namespace winrt;
4 | using namespace Windows::Foundation;
5 |
6 | namespace
7 | {
8 | IAsyncAction Async()
9 | {
10 | // This is just a simple way of testing all of the ABI and projection
11 | // error propagation in one go.
12 | throw hresult_class_not_registered(L"test message");
13 | }
14 | }
15 | TEST_CASE("hresult_class_not_registered")
16 | {
17 | REQUIRE(hresult_class_not_registered().message() == L"Class not registered");
18 | REQUIRE(hresult_class_not_registered().code() == REGDB_E_CLASSNOTREG);
19 |
20 | try
21 | {
22 | Async().get();
23 | FAIL("Previous line should throw");
24 | }
25 | catch (hresult_class_not_registered const& e)
26 | {
27 | REQUIRE(e.message() == L"test message");
28 | REQUIRE(e.code() == REGDB_E_CLASSNOTREG);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/test/test/hstring_empty.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
3 | using namespace std::literals;
4 |
5 | TEST_CASE("hstring_empty")
6 | {
7 | winrt::hstring s;
8 | REQUIRE(s.empty());
9 | REQUIRE(s.size() == 0);
10 | REQUIRE(s == L""sv);
11 | REQUIRE(std::distance(s.begin(), s.end()) == 0);
12 |
13 | // Using wcslen to both validate that the strings are empty *and* that they are not null.
14 | REQUIRE(wcslen(s.c_str()) == 0);
15 | REQUIRE(wcslen(s.data()) == 0);
16 |
17 | std::wstring_view v = s;
18 | REQUIRE(v.empty());
19 | REQUIRE(v.size() == 0);
20 | REQUIRE(v == L""sv);
21 | REQUIRE(std::distance(v.begin(), v.end()) == 0);
22 |
23 | // Using wcslen to both validate that the strings are empty *and* that they are not null.
24 | // This is not guaranteed for wstring_view, but is assumed by some code that creates a
25 | // wstring_view from an hstring.
26 | REQUIRE(wcslen(v.data()) == 0);
27 | }
28 |
--------------------------------------------------------------------------------
/test/test/iid_ppv_args.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include
3 |
4 | namespace
5 | {
6 | struct Stringable : winrt::implements
7 | {
8 | winrt::hstring ToString()
9 | {
10 | return L"hello";
11 | }
12 | };
13 |
14 | HRESULT GetStringable(GUID const& id, void** object) noexcept
15 | {
16 | *object = nullptr;
17 |
18 | if (id != __uuidof(ABI::Windows::Foundation::IStringable))
19 | {
20 | return E_NOINTERFACE;
21 | }
22 |
23 | *object = winrt::detach_abi(winrt::make());
24 | return S_OK;
25 | }
26 | }
27 |
28 | TEST_CASE("iid_ppv_args")
29 | {
30 | {
31 | winrt::com_ptr ptr;
32 | REQUIRE(S_OK == GetStringable(IID_PPV_ARGS(&ptr)));
33 | REQUIRE(ptr.as().ToString() == L"hello");
34 | }
35 | {
36 | winrt::com_ptr ptr;
37 | REQUIRE(E_NOINTERFACE == GetStringable(IID_PPV_ARGS(&ptr)));
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/test/test/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #define CATCH_CONFIG_RUNNER
3 |
4 | // Force reportFatal to be available on mingw-w64
5 | #define CATCH_CONFIG_WINDOWS_SEH
6 |
7 | #include "catch.hpp"
8 | #include "winrt/base.h"
9 |
10 | using namespace winrt;
11 |
12 | int main(int const argc, char** argv)
13 | {
14 | init_apartment();
15 | std::set_terminate([] { reportFatal("Abnormal termination"); ExitProcess(1); });
16 | _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
17 | (void)_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
18 | _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
19 | (void)_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
20 | SetThreadUILanguage(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
21 | return Catch::Session().run(argc, argv);
22 | }
23 |
24 | CATCH_TRANSLATE_EXCEPTION(hresult_error const& e)
25 | {
26 | return to_string(e.message());
27 | }
28 |
--------------------------------------------------------------------------------
/test/test/memory_buffer.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "catch.hpp"
3 |
4 | using namespace winrt;
5 | using namespace Windows::Foundation;
6 |
7 | TEST_CASE("memory_buffer")
8 | {
9 | MemoryBuffer buffer{ 3 };
10 | auto reference = buffer.CreateReference();
11 | uint8_t* ptr = reference.data();
12 | ptr[0] = 1;
13 | ptr[1] = 2;
14 | ptr[2] = 3;
15 | REQUIRE(ptr != nullptr);
16 | REQUIRE(reference.Capacity() == 3);
17 | }
18 |
--------------------------------------------------------------------------------
/test/test/missing_required_interfaces.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
3 | // Unset lean and mean so we can implement a type from the test_component namespace
4 | #undef WINRT_LEAN_AND_MEAN
5 | #include
6 |
7 | namespace
8 | {
9 | struct LiesAboutInheritance : public winrt::implements
10 | {
11 | LiesAboutInheritance() = default;
12 | void StubMethod() {}
13 | };
14 | }
15 |
16 | TEST_CASE("missing_required_interfaces")
17 | {
18 | auto lies = winrt::make_self().as();
19 | REQUIRE(lies);
20 | REQUIRE_NOTHROW(lies.StubMethod());
21 |
22 | // The IStringable::ToString method does not exist on this type. In previous versions of cppwinrt
23 | // this line would crash with a nullptr deference. It now throws an exception.
24 | REQUIRE_THROWS_AS(lies.ToString(), winrt::hresult_error);
25 | }
26 |
--------------------------------------------------------------------------------
/test/test/names.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
3 | using namespace winrt;
4 | using namespace Windows::Foundation;
5 |
6 | void check_terminated(winrt::param::hstring const&)
7 | {
8 | }
9 |
10 | TEST_CASE("names")
11 | {
12 | REQUIRE(name_of() == L"{00000000-0000-0000-c000-000000000046}"sv);
13 | STATIC_REQUIRE(name_of() == L"Object"sv);
14 |
15 | check_terminated(name_of());
16 | check_terminated(name_of());
17 | check_terminated(name_of>());
18 | check_terminated(name_of>());
19 | check_terminated(name_of());
20 | }
21 |
--------------------------------------------------------------------------------
/test/test/no_make_detection.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "winrt/test_component.h"
3 |
4 | using namespace winrt;
5 | using namespace test_component;
6 |
7 | TEST_CASE("no_make_detection")
8 | {
9 | REQUIRE(test_component::Class::TestNoMakeDetection());
10 | }
11 |
--------------------------------------------------------------------------------
/test/test/noexcept.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "winrt/test_component.h"
3 |
4 | using namespace winrt;
5 | using namespace test_component;
6 |
7 | TEST_CASE("noexcept")
8 | {
9 | Class c;
10 |
11 | c.NoexceptVoid();
12 | int32_t a = c.NoexceptInt32();
13 | hstring b = c.NoexceptString();
14 |
15 | REQUIRE(a == 123);
16 | REQUIRE(b == L"123");
17 | }
18 |
--------------------------------------------------------------------------------
/test/test/numerics.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
3 | using namespace winrt;
4 | using namespace Windows::Foundation::Numerics;
5 |
6 | TEST_CASE("numerics")
7 | {
8 | #if __has_include()
9 | // Basic smoke test exercising SIMD intrinsics used by numerics.
10 |
11 | auto one = float4::one();
12 |
13 | REQUIRE(one * one == one);
14 | #endif
15 | }
16 |
--------------------------------------------------------------------------------
/test/test/optional.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "winrt/test_component.h"
3 |
4 | using namespace winrt;
5 |
6 | TEST_CASE("optional")
7 | {
8 | test_component::Optional object;
9 |
10 | object.Property(Windows::Foundation::IReference(123));
11 | REQUIRE(object.Property().Value() == 123);
12 |
13 | object.Property(nullptr);
14 | REQUIRE(object.Property() == nullptr);
15 |
16 | object.Property(456);
17 | REQUIRE(object.Property().Value() == 456);
18 |
19 | object.Property(std::optional(789));
20 | std::optional value = object.Property();
21 | REQUIRE(value == std::optional(789));
22 | }
23 |
--------------------------------------------------------------------------------
/test/test/parent_includes.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "winrt/test_component.Parent.One.Two.Three.h"
3 |
4 | using namespace winrt::test_component;
5 |
6 | TEST_CASE("parent_includes")
7 | {
8 | // Including "...Three.h" should include all (available) ancestors, skipping
9 | // any that are empty. In this case, "Three" and "Parent" are not empty while
10 | // the intermediate namespaces are empty.
11 |
12 | Parent::One::Two::Three::ThreeStruct three;
13 | three.Value = 0;
14 |
15 | Parent::ParentStruct parent;
16 | parent.Value = 0;
17 | }
18 |
--------------------------------------------------------------------------------
/test/test/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/test/test/rational.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "winrt/test_component.h"
3 | #include "winrt/Windows.Foundation.Numerics.h"
4 |
5 | using namespace winrt;
6 | using namespace test_component;
7 |
8 | TEST_CASE("rational")
9 | {
10 | Simple simple;
11 | Windows::Foundation::Numerics::Rational rational = simple.ReturnRational();
12 | REQUIRE(rational.Numerator == 123);
13 | REQUIRE(rational.Denominator == 456);
14 |
15 | Windows::Foundation::Numerics::float2 vector2 = simple.ReturnVector2();
16 | REQUIRE(vector2.x == 123.0);
17 | REQUIRE(vector2.y == 456.0);
18 | }
19 |
--------------------------------------------------------------------------------
/test/test/struct_delegate.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "winrt/test_component.Delegates.h"
3 |
4 | using namespace winrt;
5 | using namespace test_component;
6 |
7 | TEST_CASE("struct_delegate")
8 | {
9 | Delegates::StructDelegate d = []
10 | {
11 | return com_array{ Struct{ L"First", L"Second" }, Struct{ L"Third", L"Fourth" } };
12 | };
13 |
14 | auto values = d();
15 |
16 | REQUIRE(values.size() == 2);
17 | REQUIRE(values[0].First == L"First");
18 | REQUIRE(values[0].Second == L"Second");
19 | REQUIRE(values[1].First == L"Third");
20 | REQUIRE(values[1].Second == L"Fourth");
21 | }
22 |
--------------------------------------------------------------------------------
/test/test/structs.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "winrt/test_component.Structs.Nested.h"
3 | #include "winrt/test_component_no_pch.Peer2.h"
4 |
5 | using namespace winrt;
6 |
7 | TEST_CASE("structs")
8 | {
9 | test_component::Structs::Nested::Outer outer{};
10 | outer.Depends.InnerValue = 1;
11 | outer.OuterValue = 2;
12 |
13 | test_component_no_pch::Peer2::B depends{};
14 | depends.First.Value = 1;
15 |
16 | test_component::Structs::All all{};
17 | all.H = {};
18 | }
19 |
--------------------------------------------------------------------------------
/test/test/suppress_error_info.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include
3 |
4 | TEST_CASE("suppress_error_info")
5 | {
6 | winrt::check_hresult(RoSetErrorReportingFlags(RO_ERROR_REPORTING_SUPPRESSSETERRORINFO));
7 |
8 | // Since the error information is suppressed, the best we can hope for is that C++/WinRT
9 | // will provide a generic message for the HRESULT.
10 | REQUIRE(winrt::hresult_error(E_FAIL, L"message").message() == L"Unspecified error");
11 |
12 | winrt::check_hresult(RoSetErrorReportingFlags(RO_ERROR_REPORTING_USESETERRORINFO));
13 |
14 | // The default behavior has been restored, so C++/WinRT can faithfully provide error
15 | // information as usual.
16 | REQUIRE(winrt::hresult_error(E_FAIL, L"message").message() == L"message");
17 | }
18 |
--------------------------------------------------------------------------------
/test/test_component/Optional.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "Optional.h"
3 | #include "Optional.g.cpp"
4 |
--------------------------------------------------------------------------------
/test/test_component/Optional.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "Optional.g.h"
3 |
4 | namespace winrt::test_component::implementation
5 | {
6 | struct Optional : OptionalT
7 | {
8 | Optional() = default;
9 |
10 | Windows::Foundation::IReference Property()
11 | {
12 | return m_property;
13 | }
14 |
15 | void Property(Windows::Foundation::IReference const& value)
16 | {
17 | m_property = value;
18 | }
19 |
20 | std::optional m_property;
21 | };
22 | }
23 | namespace winrt::test_component::factory_implementation
24 | {
25 | struct Optional : OptionalT
26 | {
27 | };
28 | }
29 |
--------------------------------------------------------------------------------
/test/test_component/OverloadClass.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "OverloadClass.h"
3 | #include "OverloadClass.g.cpp"
4 |
5 | namespace winrt::test_component::implementation
6 | {
7 | void OverloadClass::Overload()
8 | {
9 | throw hresult_not_implemented();
10 | }
11 | void OverloadClass::Overload(int /*a*/)
12 | {
13 | throw hresult_not_implemented();
14 | }
15 | void OverloadClass::Overload(int /*a*/, int /*b*/)
16 | {
17 | throw hresult_not_implemented();
18 | }
19 | void OverloadClass::Overload(int /*a*/, int /*b*/, int /*c*/)
20 | {
21 | throw hresult_not_implemented();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/test/test_component/OverloadClass.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "OverloadClass.g.h"
3 |
4 | namespace winrt::test_component::implementation
5 | {
6 | struct OverloadClass : OverloadClassT
7 | {
8 | OverloadClass() = default;
9 |
10 | void Overload();
11 | void Overload(int a);
12 | void Overload(int a, int b);
13 | void Overload(int a, int b, int c);
14 | };
15 | }
16 | namespace winrt::test_component::factory_implementation
17 | {
18 | struct OverloadClass : OverloadClassT
19 | {
20 | };
21 | }
22 |
--------------------------------------------------------------------------------
/test/test_component/Simple.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "Simple.h"
3 | #include "Simple.g.cpp"
4 |
5 | namespace winrt::test_component::implementation
6 | {
7 | void Simple::Method()
8 | {
9 | throw hresult_not_implemented();
10 | }
11 | Windows::Foundation::IReference Simple::Reference(Windows::Foundation::DateTime const&)
12 | {
13 | throw hresult_not_implemented();
14 | }
15 | Windows::Foundation::IAsyncOperation Simple::Operation(Windows::Foundation::DateTime)
16 | {
17 | throw hresult_not_implemented();
18 | }
19 | Windows::Foundation::IAsyncAction Simple::Action(Windows::Foundation::DateTime)
20 | {
21 | throw hresult_not_implemented();
22 | }
23 | Windows::Foundation::IInspectable Simple::Object(Windows::Foundation::DateTime const&)
24 | {
25 | throw hresult_not_implemented();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/test/test_component/Velocity.Class1.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "Velocity.Class1.h"
3 | #include "Velocity.Class1.g.cpp"
4 |
5 | namespace winrt::test_component::Velocity::implementation
6 | {
7 | void Class1::Class1_Method()
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/test_component/Velocity.Class1.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "Velocity.Class1.g.h"
3 |
4 | namespace winrt::test_component::Velocity::implementation
5 | {
6 | struct Class1 : Class1T
7 | {
8 | Class1() = default;
9 |
10 | void Class1_Method();
11 | };
12 | }
13 | namespace winrt::test_component::Velocity::factory_implementation
14 | {
15 | struct Class1 : Class1T
16 | {
17 | };
18 | }
19 |
--------------------------------------------------------------------------------
/test/test_component/Velocity.Class2.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "Velocity.Class2.h"
3 | #include "Velocity.Class2.g.cpp"
4 |
5 | namespace winrt::test_component::Velocity::implementation
6 | {
7 | void Class2::Class2_Method()
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/test_component/Velocity.Class2.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "Velocity.Class2.g.h"
3 |
4 | namespace winrt::test_component::Velocity::implementation
5 | {
6 | struct Class2 : Class2T
7 | {
8 | Class2() = default;
9 |
10 | void Class2_Method();
11 | };
12 | }
13 | namespace winrt::test_component::Velocity::factory_implementation
14 | {
15 | struct Class2 : Class2T
16 | {
17 | };
18 | }
19 |
--------------------------------------------------------------------------------
/test/test_component/Velocity.Class4.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "Velocity.Class4.h"
3 | #include "Velocity.Class4.g.cpp"
4 |
5 | namespace winrt::test_component::Velocity::implementation
6 | {
7 | Class4::Class4(int32_t)
8 | {
9 | }
10 | Class4::Class4(int32_t, int32_t)
11 | {
12 | }
13 | void Class4::Class4_Static1()
14 | {
15 | }
16 | void Class4::Class4_Static2()
17 | {
18 | }
19 | void Class4::Class4_Method()
20 | {
21 | }
22 | void Class4::IInterface1_Method()
23 | {
24 | }
25 | void Class4::IInterface2_Method()
26 | {
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/test/test_component/Velocity.Class4.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "Velocity.Class4.g.h"
3 |
4 | namespace winrt::test_component::Velocity::implementation
5 | {
6 | struct Class4 : Class4T
7 | {
8 | Class4() = default;
9 |
10 | Class4(int32_t one);
11 | Class4(int32_t one, int32_t two);
12 | static void Class4_Static1();
13 | static void Class4_Static2();
14 | void Class4_Method();
15 | void IInterface1_Method();
16 | void IInterface2_Method();
17 | };
18 | }
19 | namespace winrt::test_component::Velocity::factory_implementation
20 | {
21 | struct Class4 : Class4T
22 | {
23 | };
24 | }
25 |
--------------------------------------------------------------------------------
/test/test_component/Windows.Class.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "Windows.Class.h"
3 | #include "Windows.Class.g.cpp"
4 |
5 | namespace winrt::test_component::Windows::implementation
6 | {
7 | void Class::StaticMethod(winrt::test_component::Windows::Struct const&)
8 | {
9 | throw hresult_not_implemented();
10 | }
11 | void Class::Method(winrt::Windows::Foundation::Uri const&)
12 | {
13 | throw hresult_not_implemented();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/test/test_component/Windows.Class.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "Windows.Class.g.h"
3 |
4 | namespace winrt::test_component::Windows::implementation
5 | {
6 | struct Class : ClassT
7 | {
8 | Class() = default;
9 |
10 | static void StaticMethod(winrt::test_component::Windows::Struct const& param);
11 | void Method(winrt::Windows::Foundation::Uri const& param);
12 | };
13 | }
14 | namespace winrt::test_component::Windows::factory_implementation
15 | {
16 | struct Class : ClassT
17 | {
18 | };
19 | }
20 |
--------------------------------------------------------------------------------
/test/test_component/exports.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | DllCanUnloadNow PRIVATE
3 | DllGetActivationFactory PRIVATE
4 |
--------------------------------------------------------------------------------
/test/test_component/module.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
3 | bool __stdcall test_can_unload_now() noexcept;
4 | void* __stdcall test_get_activation_factory(std::wstring_view const& name);
5 |
6 | int32_t __stdcall DllCanUnloadNow() noexcept
7 | {
8 | return test_can_unload_now() ? 0 : 1;
9 | }
10 |
11 | int32_t __stdcall DllGetActivationFactory(void* classId, void** factory) noexcept
12 | {
13 | try
14 | {
15 | std::wstring_view const name{ *reinterpret_cast(&classId) };
16 | *factory = test_get_activation_factory(name);
17 |
18 | if (*factory)
19 | {
20 | return 0;
21 | }
22 |
23 | return winrt::hresult_class_not_available(name).to_abi();
24 | }
25 | catch (...)
26 | {
27 | return winrt::to_hresult();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/test/test_component/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/test/test_component/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #define WINRT_LEAN_AND_MEAN
4 | #define WINRT_NO_MAKE_DETECTION // for test in Class.cpp
5 | #include
6 | #include
7 |
--------------------------------------------------------------------------------
/test/test_component/test_auto.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "winrt/test_component.h"
3 |
4 | // Simple compile-only test to validate that static methods may be compiled with -optimize.
5 | // Previously this wouldn't compile because of return type deduction colliding with -optimize
6 | // and its use of the linker to support uniform construction.
7 |
8 | using namespace winrt;
9 | using namespace test_component;
10 |
11 | void test_auto()
12 | {
13 | Class::StaticTest();
14 |
15 | Class::StaticTestReturn();
16 |
17 | [[maybe_unused]] auto discarded = Class::StaticProperty();
18 | }
--------------------------------------------------------------------------------
/test/test_component/test_overload.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "winrt/test_component.h"
3 |
4 | // Simple compile-only test to validate overloads coming from overridable interfaces compile.
5 |
6 | using namespace winrt;
7 | using namespace test_component;
8 |
9 | struct DerivedClass : OverloadClassT
10 | {
11 | void Foo()
12 | {
13 | // make sure we can actually call the overloads (no ambiguous call errors)
14 | Overload();
15 | Overload(1);
16 | Overload(1, 2);
17 | Overload(1, 2, 3);
18 | }
19 | };
--------------------------------------------------------------------------------
/test/test_component_base/HierarchyA.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "HierarchyA.h"
3 |
4 | namespace winrt::test_component_base::implementation
5 | {
6 | HierarchyA::HierarchyA(hstring const& /*name*/)
7 | {
8 | throw hresult_not_implemented();
9 | }
10 | HierarchyA::HierarchyA(int32_t /*dummy*/, hstring const& /*name*/)
11 | {
12 | throw hresult_not_implemented();
13 | }
14 | void HierarchyA::HierarchyA_Method()
15 | {
16 | //test_component_base::HierarchyA a = *this;
17 | //assert(a);
18 |
19 | //test_component_base::IHierarchyA ia = *this;
20 | //assert(a);
21 | }
22 | int HierarchyA::HierarchyA_Protected()
23 | {
24 | return 42;
25 | }
26 |
27 | static_assert(!std::is_constructible_v);
28 | }
29 |
--------------------------------------------------------------------------------
/test/test_component_base/HierarchyA.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "HierarchyA.g.h"
3 |
4 | namespace winrt::test_component_base::implementation
5 | {
6 | struct HierarchyA : HierarchyAT
7 | {
8 | HierarchyA() = default;
9 |
10 | HierarchyA(hstring const& name);
11 | HierarchyA(int32_t dummy, hstring const& name);
12 | void HierarchyA_Method();
13 | int HierarchyA_Protected();
14 | };
15 | }
16 | namespace winrt::test_component_base::factory_implementation
17 | {
18 | struct HierarchyA : HierarchyAT
19 | {
20 | };
21 | }
22 |
--------------------------------------------------------------------------------
/test/test_component_base/HierarchyB.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "HierarchyB.h"
3 |
4 | #pragma warning(disable: 4702)
5 |
6 | namespace winrt::test_component_base::implementation
7 | {
8 | HierarchyB::HierarchyB(hstring const& /*name*/)
9 | {
10 | throw hresult_not_implemented();
11 | }
12 | HierarchyB::HierarchyB(int32_t dummy, hstring const& name) : HierarchyB_base(dummy, name)
13 | {
14 | throw hresult_not_implemented();
15 | }
16 | void HierarchyB::HierarchyB_Method()
17 | {
18 | throw hresult_not_implemented();
19 | }
20 | void HierarchyB::HierarchyB_TestInnerProtected()
21 | {
22 | assert(HierarchyA_Protected() == 42);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/test/test_component_base/HierarchyB.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "HierarchyB.g.h"
3 | #include "HierarchyA.h"
4 |
5 | namespace winrt::test_component_base::implementation
6 | {
7 | struct HierarchyB : HierarchyBT