-
Notifications
You must be signed in to change notification settings - Fork 991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix inversion of conditional #4685
Changes from all commits
e21a29a
a49857a
fe02e8d
fd86d55
c55ee54
54fd70e
734d2dc
f18c0fe
0c160b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
[assembly: InternalsVisibleTo("MauiRichTextBoxTests, PublicKey=00000000000000000400000000000000")] | ||
[assembly: InternalsVisibleTo("MauiTestsHelper, PublicKey=00000000000000000400000000000000")] | ||
[assembly: InternalsVisibleTo("MauiTabControlTests, PublicKey=00000000000000000400000000000000")] | ||
[assembly: InternalsVisibleTo("NativeHost.ManagedControl, PublicKey=00000000000000000400000000000000")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. only necessary because I don't know how to set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. App.config did not work? winforms removed dependency but the functionality should be there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought it was removed entirely, I'll try if it works There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, the instructions don't seem to work. I've tried several variations how to name the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strange. For this test project, we can keep as-is. I will play around with winforms projects to see if entire config is not working or some sections are not populated. |
||
|
||
// This is needed in order to Moq internal interfaces for testing | ||
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13834,7 +13834,7 @@ unsafe HRESULT Ole32.IOleObject.GetMiscStatus(Ole32.DVASPECT dwAspect, Ole32.OLE | |
return HRESULT.E_POINTER; | ||
} | ||
|
||
if ((dwAspect & Ole32.DVASPECT.CONTENT) != 0) | ||
if ((dwAspect & Ole32.DVASPECT.CONTENT) == 0) | ||
{ | ||
Debug.WriteLineIf(CompModSwitches.ActiveX.TraceInfo, "AxSource:GetMiscStatus. Status: ERROR, wrong aspect."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Note that observing this message without the above fix applied requires a debug build and running in a debugger. It can be tested by running the NativeHost from inside VS (flip the comparison back to test the original regression). |
||
*pdwStatus = 0; | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.ComponentModel; | ||
using System.Runtime.InteropServices; | ||
using System.Windows.Forms; | ||
|
||
namespace NativeHost | ||
{ | ||
[ComVisible(true)] | ||
[Guid("54479E5D-EABC-448C-A767-EAFF17BC28C9")] | ||
[ComDefaultInterface(typeof(IManagedControl))] | ||
public partial class ManagedControl : UserControl, IManagedControl | ||
{ | ||
public ManagedControl() | ||
{ | ||
CompModSwitches.ActiveX.Level = System.Diagnostics.TraceLevel.Verbose; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it would be better to do this via some configuration, but how? |
||
|
||
InitializeComponent(); | ||
} | ||
|
||
private void button1_Click(object sender, EventArgs e) | ||
{ | ||
MessageBox.Show("Hello world from .NET"); | ||
} | ||
} | ||
|
||
[ComVisible(true)] | ||
[Guid("3223D73E-286A-462C-AF8D-392D472673BF")] | ||
[InterfaceType(ComInterfaceType.InterfaceIsDual)] | ||
public interface IManagedControl { } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<root> | ||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | ||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | ||
<xsd:element name="root" msdata:IsDataSet="true"> | ||
<xsd:complexType> | ||
<xsd:choice maxOccurs="unbounded"> | ||
<xsd:element name="metadata"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" use="required" type="xsd:string" /> | ||
<xsd:attribute name="type" type="xsd:string" /> | ||
<xsd:attribute name="mimetype" type="xsd:string" /> | ||
<xsd:attribute ref="xml:space" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="assembly"> | ||
<xsd:complexType> | ||
<xsd:attribute name="alias" type="xsd:string" /> | ||
<xsd:attribute name="name" type="xsd:string" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="data"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | ||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||
<xsd:attribute ref="xml:space" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="resheader"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" type="xsd:string" use="required" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
</xsd:choice> | ||
</xsd:complexType> | ||
</xsd:element> | ||
</xsd:schema> | ||
<resheader name="resmimetype"> | ||
<value>text/microsoft-resx</value> | ||
</resheader> | ||
<resheader name="version"> | ||
<value>2.0</value> | ||
</resheader> | ||
<resheader name="reader"> | ||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
<resheader name="writer"> | ||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
</root> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<AssemblyName>NativeHost.ManagedControl</AssemblyName> | ||
<Platforms>x86;x64</Platforms> | ||
<EnableComHosting>true</EnableComHosting> | ||
|
||
<EnableXlfLocalization>false</EnableXlfLocalization> | ||
<UpdateXlfOnBuild>false</UpdateXlfOnBuild> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\..\System.Windows.Forms.Primitives\src\System.Windows.Forms.Primitives.csproj" /> | ||
<ProjectReference Include="..\..\..\src\System.Windows.Forms.csproj" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<!-- workaround for https://github.com/dotnet/sdk/pull/19764 --> | ||
<EnableDynamicLoading>true</EnableDynamicLoading> | ||
</PropertyGroup> | ||
|
||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<!-- provides minimum msbuild target stubs so we can reference the project in arcade without building it --> | ||
<Target Name="_IsProjectRestoreSupported" Returns="@(_ValidProjectsForRestore)"> | ||
<ItemGroup> | ||
<_ValidProjectsForRestore Include="$(MSBuildProjectFullPath)" /> | ||
</ItemGroup> | ||
</Target> | ||
<Target Name="Restore" /> | ||
<Target Name="Clean" /> | ||
<Target Name="Build" /> | ||
<Target Name="Rebuild" /> | ||
<Target Name="Pack" /> | ||
<Target Name="Test" /> | ||
<Target Name="IntegrationTest" /> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
#include "pch.h" | ||
|
||
class CMainWindow : public CFrameWnd | ||
{ | ||
public: | ||
CWnd m_control; | ||
|
||
BOOL Create() | ||
{ | ||
CREATESTRUCT cs{}; | ||
cs.style = WS_OVERLAPPEDWINDOW; | ||
|
||
if (!PreCreateWindow(cs)) | ||
return FALSE; | ||
|
||
if (!CFrameWnd::Create(cs.lpszClass, m_strTitle)) | ||
return FALSE; | ||
|
||
return TRUE; | ||
} | ||
|
||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct) | ||
{ | ||
if (CFrameWnd::OnCreate(lpCreateStruct) == -1) | ||
return -1; | ||
|
||
CLSID clsid; | ||
if (FAILED(IIDFromString(L"{54479E5D-EABC-448C-A767-EAFF17BC28C9}", &clsid))) | ||
return -1; | ||
|
||
if (!m_control.CreateControl(clsid, NULL, AFX_WS_DEFAULT_VIEW, CRect(), this, AFX_IDW_PANE_FIRST)) | ||
return -1; | ||
|
||
return 0; | ||
} | ||
|
||
afx_msg void OnSize(UINT nType, int cx, int cy) | ||
{ | ||
if (m_control) | ||
m_control.SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER); | ||
} | ||
|
||
afx_msg void OnSetFocus(CWnd* pOldWnd) | ||
{ | ||
if (m_control) | ||
m_control.SetFocus(); | ||
} | ||
|
||
DECLARE_MESSAGE_MAP() | ||
}; | ||
|
||
BEGIN_MESSAGE_MAP(CMainWindow, CFrameWnd) | ||
ON_WM_CREATE() | ||
ON_WM_SIZE() | ||
ON_WM_SETFOCUS() | ||
END_MESSAGE_MAP() | ||
|
||
class CNativeHostApp : public CWinApp | ||
{ | ||
public: | ||
BOOL InitInstance() override | ||
{ | ||
CWinApp::InitInstance(); | ||
|
||
AfxEnableControlContainer(); | ||
|
||
auto pWindow = new CMainWindow; | ||
if (!pWindow) | ||
return FALSE; | ||
|
||
m_pMainWnd = pWindow; | ||
|
||
pWindow->SetTitle(L"Native WinForms Host"); | ||
|
||
if (!pWindow->Create()) | ||
return FALSE; | ||
|
||
pWindow->ShowWindow(SW_SHOW); | ||
pWindow->UpdateWindow(); | ||
|
||
return TRUE; | ||
} | ||
|
||
int ExitInstance() override | ||
{ | ||
// a clean exit is currently not possible, we would have to force a garbage collection | ||
// to ensure WinForms had a chance to release its COM objects before MFC exits | ||
TerminateProcess(GetCurrentProcess(), S_OK); | ||
Comment on lines
+90
to
+92
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In debug builds MFC cannot cleanly shutdown due to hitting an assert, WinForms still has references to MFC. I assume forcing a GC might help, but thats not easily doable. As a workaround I just terminate the process. |
||
|
||
return CWinApp::ExitInstance(); | ||
} | ||
}; | ||
|
||
CNativeHostApp app; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is weird but consistent with the other native project you're building