Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
7a1b85c
Move all Guid properties to InterfaceIIDs
kythant Oct 9, 2025
4857120
Add one more space at the end
kythant Oct 9, 2025
8068f04
Fix up names and directly references from classes outside of Interfac…
kythant Oct 9, 2025
56b27e2
rename write_iid_guid_property_from_signature
kythant Oct 9, 2025
797774e
inteface chkpt
kythant Oct 9, 2025
b65cf4e
Merge branch 'staging/3.0' of https://github.com/microsoft/CsWinRT in…
kythant Oct 10, 2025
928d46b
Chkpt IClosable
kythant Oct 11, 2025
dd34589
chkpt conditional
kythant Oct 13, 2025
09208dc
Update other references to write_iid_guid_reference
kythant Oct 13, 2025
bc9f9aa
Move delegate IID out chkpt
kythant Oct 13, 2025
adbe415
Update references; write_iid_guid_with_type_semantics; Remove from cl…
kythant Oct 14, 2025
359b5ba
The last ones'
kythant Oct 14, 2025
3c21b0c
chkpt on write
kythant Oct 14, 2025
7528f1f
Finalize move to GeneratedInterfaceIIDs
kythant Oct 14, 2025
2c223cc
Trim fat on GeneratedInterfaceIIDs.cs
kythant Oct 14, 2025
4d50e39
Cleanupts
kythant Oct 14, 2025
3d4cc22
Resolve merge conflict
kythant Oct 14, 2025
6000b8b
Fix new line
kythant Oct 14, 2025
ad66e1e
Initial chkpt
kythant Oct 16, 2025
46b9b92
Chkpt
kythant Oct 17, 2025
3ad5c0a
Chkpt with GetExceptionForHR
kythant Oct 17, 2025
5f0ef64
ThrowExceptionForHR
kythant Oct 17, 2025
3e8902a
GetHRForException
kythant Oct 17, 2025
3ca82b9
GetHRForException
kythant Oct 17, 2025
f6e11bb
GetHRForException
kythant Oct 17, 2025
1e0eb99
chkpt: SetErrorInfo
kythant Oct 17, 2025
8d19db3
chkpt: ReportUnhandledError
kythant Oct 17, 2025
e0127f2
GeneratedComInterface IErrorInfo
kythant Oct 18, 2025
d5725a4
Merge
kythant Oct 20, 2025
eb42981
Merge branch 'staging/3.0' of https://github.com/microsoft/CsWinRT in…
kythant Oct 21, 2025
b0a537d
Revert src/WinRT.Runtime/IInspectable.net5.cs
kythant Oct 23, 2025
1a74cbc
Move to vtables
kythant Oct 23, 2025
47deae4
Move error codes out of ExceptionHelpers to WellKnownErrorCodes.tt
kythant Oct 23, 2025
825c319
Separate each interface methods into each own file
kythant Oct 23, 2025
2f9813e
Address code review comments with vtbls
kythant Oct 23, 2025
1fd3eb7
Remove unsafe
kythant Oct 23, 2025
d544d8b
Don't need null check in ExceptionErrorInfo.net5 GetDescription
kythant Oct 23, 2025
8e42282
remove all #ifdef NET8_0_OR_GREATER
kythant Oct 23, 2025
f780aaa
Eliminate initalize in ExceptionHelpers
kythant Oct 23, 2025
85b5c27
Directly call using pInvoke
kythant Oct 23, 2025
416069e
Don't need these
kythant Oct 23, 2025
bb5954d
Remove unnecessary switch in WindowsRuntimeFeatureSwitches.cs
kythant Oct 23, 2025
366bfe7
Builds but doesn't run correctly
kythant Oct 23, 2025
adb7c0b
Fix ILanguageExceptionErrorInfo2Vftbl.cs
kythant Oct 24, 2025
b4648c0
Some error handling'
kythant Oct 24, 2025
111e8ee
Address code review'
kythant Oct 24, 2025
f6ab5cc
Comment for testing
kythant Oct 24, 2025
35969d6
Make GetLanguageExceptionInternal safe
kythant Oct 24, 2025
6ac6010
THis should be current
kythant Oct 24, 2025
bf9d336
Improvements to GetLanguageExceptionInternal
kythant Oct 24, 2025
081cf64
GetHRForException was duplicated
kythant Oct 24, 2025
5fee8dc
Remove unused code from ExceptionHelpers.cs
kythant Oct 24, 2025
0a9096c
Fix up on FreeThreadedMarshaler.cs
kythant Oct 24, 2025
0e8fd97
rename variable on FreeThreadedMarshaler.cs
kythant Oct 24, 2025
896b5df
various code review fixup
kythant Oct 24, 2025
8043244
Don't need type on discard out parmaeter
kythant Oct 24, 2025
2608590
Revert assert changes in FreeThreadedMarshaler.cs
kythant Oct 24, 2025
40f77c3
Other assert changes
kythant Oct 24, 2025
48762c3
Remove #if Net from GetExceptionForHR
kythant Oct 27, 2025
41981f6
Delete unused type
kythant Oct 28, 2025
5fb4433
Refactor Exception into each own file
kythant Oct 28, 2025
47eba03
Add xml doc comments
kythant Oct 28, 2025
2e3b861
Move and rename RestrictedErrorInfoMethods.cs
kythant Oct 28, 2025
e50b510
Delete LanguageExceptionErrorInfoMethods2.cs and use CapturePropagati…
kythant Oct 28, 2025
c11fda9
Xml docs comment on RestrictedErrorInfoMethods.cs
kythant Oct 28, 2025
58a3b33
Update comments and spacing for readibility on FreeThreadedMarshaler.cs
kythant Oct 28, 2025
7c29aed
Code review comments on src/WinRT.Runtime2/InteropServices/Restricted…
kythant Oct 28, 2025
65ba9ef
Code review comments on ExceptionHelpers.cs:
kythant Oct 28, 2025
dbd7765
Add xml docs comments:
kythant Oct 28, 2025
dbc54ca
Don't use abbrev
kythant Oct 28, 2025
65e5cab
Spacing
kythant Oct 28, 2025
9926b2a
Move files to InteropServices/Exceptions
kythant Oct 28, 2025
2f3006e
eliminate this usage in exception helpers
kythant Oct 28, 2025
f8a8757
Rename to IRestrictedErrorInfoMethods
kythant Oct 28, 2025
ace7c4d
Update hr to hresult
kythant Oct 28, 2025
f230fc1
Address code review comments pt1
kythant Oct 28, 2025
0a6dc9a
Whitespace
kythant Oct 28, 2025
70bb3da
second out parameter should be HRESULT*
kythant Oct 28, 2025
6236b95
AddExceptionDataForRestrictedErrorInfo at the end of GetExceptionForHR
kythant Oct 29, 2025
880b897
Use CreateUnsafe in GetExceptionForHR
kythant Oct 29, 2025
4fcd771
TODO comment
kythant Oct 30, 2025
8423d1d
Add missing FormatMessageW code to GetExceptionForHR
kythant Oct 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
594 changes: 297 additions & 297 deletions src/Authoring/WinRT.Host/WinRT.Host.vcxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="test.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="Directory.Build.targets" />
<None Include="WinRT.Host.runtimeconfig.json" />
<None Include="DoNotImport_MsAppxPackageTargets.targets" />
</ItemGroup>
<ItemGroup>
<Manifest Include="AuthoringConsumptionTest.exe.manifest" />
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="test.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="Directory.Build.targets" />
<None Include="WinRT.Host.runtimeconfig.json" />
<None Include="DoNotImport_MsAppxPackageTargets.targets" />
</ItemGroup>
<ItemGroup>
<Manifest Include="AuthoringConsumptionTest.exe.manifest" />
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions src/Tests/TestComponentCSharp/ManualProjectionTestClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ namespace winrt::TestComponentCSharp::implementation

void CustomDisposableTest::Close()
{
// Leaving in for testing purposes
// throw winrt::hresult_access_denied();
}

CustomBindableVectorTest::CustomBindableVectorTest()
Expand Down
300 changes: 150 additions & 150 deletions src/Tests/TestComponentCSharp/TestComponentCSharp.vcxproj

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/WinRT.Runtime/IInspectable.net5.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ partial class IInspectable : IWinRTObject
{
IObjectReference IWinRTObject.NativeObject => _obj;
bool IWinRTObject.HasUnwrappableNativeObject => true;

private volatile ConcurrentDictionary<RuntimeTypeHandle, IObjectReference> _queryInterfaceCache;
private ConcurrentDictionary<RuntimeTypeHandle, IObjectReference> MakeQueryInterfaceCache()
{
System.Threading.Interlocked.CompareExchange(ref _queryInterfaceCache, new ConcurrentDictionary<RuntimeTypeHandle, IObjectReference>(), null);
System.Threading.Interlocked.CompareExchange(ref _queryInterfaceCache, new ConcurrentDictionary<RuntimeTypeHandle, IObjectReference>(), null);
return _queryInterfaceCache;
}
ConcurrentDictionary<RuntimeTypeHandle, IObjectReference> IWinRTObject.QueryInterfaceCache => _queryInterfaceCache ?? MakeQueryInterfaceCache();
private volatile ConcurrentDictionary<RuntimeTypeHandle, object> _additionalTypeData;
private ConcurrentDictionary<RuntimeTypeHandle, object> MakeAdditionalTypeData()
{
System.Threading.Interlocked.CompareExchange(ref _additionalTypeData, new ConcurrentDictionary<RuntimeTypeHandle, object>(), null);
System.Threading.Interlocked.CompareExchange(ref _additionalTypeData, new ConcurrentDictionary<RuntimeTypeHandle, object>(), null);
return _additionalTypeData;
}
ConcurrentDictionary<RuntimeTypeHandle, object> IWinRTObject.AdditionalTypeData => _additionalTypeData ?? MakeAdditionalTypeData();
}

}
}
2 changes: 1 addition & 1 deletion src/WinRT.Runtime2/ABI/System/Exception.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static Exception ConvertToUnmanaged(global::System.Exception? value)
/// <returns>The managed <see cref="global::System.Exception"/> value</returns>
public static global::System.Exception? ConvertToManaged(Exception value)
{
return RestrictedErrorInfo.GetExceptionForHR(value.Value);
return RestrictedErrorInfo.GetExceptionForHR(value.Value, out _);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using WindowsRuntime.InteropServices;

namespace Microsoft.UI.Xaml;

/// <summary>
/// Represents an exception that occurs when an element is not available.
/// </summary>
/// <remarks>
/// Sets <see cref="Exception.HResult"/> to <see cref="WellKnownErrorCodes.E_ELEMENTNOTAVAILABLE"/>
/// to enable consistent interop/error mapping.
/// </remarks>
internal sealed class ElementNotAvailableException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="ElementNotAvailableException"/> class
/// with a default error message indicating the element is not available.
/// </summary>
public ElementNotAvailableException()
: base("The element is not available.")
{
HResult = WellKnownErrorCodes.E_ELEMENTNOTAVAILABLE;
}

/// <summary>
/// Initializes a new instance of the <see cref="ElementNotAvailableException"/> class
/// with a specified error message.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
public ElementNotAvailableException(string message)
: base(message)
{
HResult = WellKnownErrorCodes.E_ELEMENTNOTAVAILABLE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using WindowsRuntime.InteropServices;

namespace Microsoft.UI.Xaml;

/// <summary>
/// Represents an exception that occurs when an element is not enabled.
/// </summary>
/// <remarks>
/// Sets <see cref="Exception.HResult"/> to <see cref="WellKnownErrorCodes.E_ELEMENTNOTENABLED"/>
/// to enable consistent interop/error mapping.
/// </remarks>
internal sealed class ElementNotEnabledException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="ElementNotEnabledException"/> class
/// with a default error message indicating the element is not enabled.
/// </summary>
public ElementNotEnabledException()
: base("The element is not enabled.")
{
HResult = WellKnownErrorCodes.E_ELEMENTNOTENABLED;
}

/// <summary>
/// Initializes a new instance of the <see cref="ElementNotEnabledException"/> class
/// with a specified error message.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
public ElementNotEnabledException(string message)
: base(message)
{
HResult = WellKnownErrorCodes.E_ELEMENTNOTENABLED;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using WindowsRuntime.InteropServices;

namespace Microsoft.UI.Xaml;

/// <summary>
/// Represents an exception that occurs when a layout cycle is detected during GUI layout.
/// </summary>
/// <remarks>
/// Sets <see cref="Exception.HResult"/> to <see cref="WellKnownErrorCodes.E_LAYOUTCYCLE"/>
/// to enable consistent interop/error mapping.
/// </remarks>
internal sealed class LayoutCycleException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="LayoutCycleException"/> class
/// with a default error message indicating a layout cycle occurred.
/// </summary>
public LayoutCycleException()
: base("A cycle occurred while laying out the GUI.")
{
HResult = WellKnownErrorCodes.E_LAYOUTCYCLE;
}

/// <summary>
/// Initializes a new instance of the <see cref="LayoutCycleException"/> class
/// with a specified error message.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
public LayoutCycleException(string message)
: base(message)
{
HResult = WellKnownErrorCodes.E_LAYOUTCYCLE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using WindowsRuntime.InteropServices;

namespace Microsoft.UI.Xaml;

/// <summary>
/// Represents an exception that occurs when XAML parsing fails.
/// </summary>
/// <remarks>
/// Sets <see cref="Exception.HResult"/> to <see cref="WellKnownErrorCodes.E_XAMLPARSEFAILED"/>
/// to enable consistent interop/error mapping.
/// </remarks>
internal sealed class XamlParseException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="XamlParseException"/> class
/// with a default error message indicating XAML parsing failure.
/// </summary>
public XamlParseException()
: base("XAML parsing failed.")
{
HResult = WellKnownErrorCodes.E_XAMLPARSEFAILED;
}

/// <summary>
/// Initializes a new instance of the <see cref="XamlParseException"/> class
/// with a specified error message.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
public XamlParseException(string message)
: base(message)
{
HResult = WellKnownErrorCodes.E_XAMLPARSEFAILED;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using WindowsRuntime.InteropServices;

namespace Windows.UI.Xaml;

/// <summary>
/// Represents an exception that occurs when an element is not available.
/// </summary>
/// <remarks>
/// Sets <see cref="Exception.HResult"/> to <see cref="WellKnownErrorCodes.E_ELEMENTNOTAVAILABLE"/>
/// to enable consistent interop/error mapping.
/// </remarks>
internal sealed class ElementNotAvailableException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="ElementNotAvailableException"/> class
/// with a default error message indicating the element is not available.
/// </summary>
public ElementNotAvailableException()
: base("The element is not available.")
{
HResult = WellKnownErrorCodes.E_ELEMENTNOTAVAILABLE;
}

/// <summary>
/// Initializes a new instance of the <see cref="ElementNotAvailableException"/> class
/// with a specified error message.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
public ElementNotAvailableException(string message)
: base(message)
{
HResult = WellKnownErrorCodes.E_ELEMENTNOTAVAILABLE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using WindowsRuntime.InteropServices;

namespace Windows.UI.Xaml;

/// <summary>
/// Represents an exception that occurs when an element is not enabled.
/// </summary>
/// <remarks>
/// Sets <see cref="Exception.HResult"/> to <see cref="WellKnownErrorCodes.E_ELEMENTNOTENABLED"/>
/// to enable consistent interop/error mapping.
/// </remarks>
internal sealed class ElementNotEnabledException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="ElementNotEnabledException"/> class
/// with a default error message indicating the element is not enabled.
/// </summary>
public ElementNotEnabledException()
: base("The element is not enabled.")
{
HResult = WellKnownErrorCodes.E_ELEMENTNOTENABLED;
}

/// <summary>
/// Initializes a new instance of the <see cref="ElementNotEnabledException"/> class
/// with a specified error message.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
public ElementNotEnabledException(string message)
: base(message)
{
HResult = WellKnownErrorCodes.E_ELEMENTNOTENABLED;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using WindowsRuntime.InteropServices;

namespace Windows.UI.Xaml;

/// <summary>
/// Represents an exception that occurs when a layout cycle is detected during GUI layout.
/// </summary>
/// <remarks>
/// Sets <see cref="Exception.HResult"/> to <see cref="WellKnownErrorCodes.E_LAYOUTCYCLE"/>
/// to enable consistent interop/error mapping.
/// </remarks>
internal sealed class LayoutCycleException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="LayoutCycleException"/> class
/// with a default error message indicating a layout cycle occurred.
/// </summary>
public LayoutCycleException()
: base("A cycle occurred while laying out the GUI.")
{
HResult = WellKnownErrorCodes.E_LAYOUTCYCLE;
}

/// <summary>
/// Initializes a new instance of the <see cref="LayoutCycleException"/> class
/// with a specified error message.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
public LayoutCycleException(string message)
: base(message)
{
HResult = WellKnownErrorCodes.E_LAYOUTCYCLE;
}
}
Loading
Loading