林德熙 - 微软最具价值专家和 .NET 基金会成员
rebase可以修改记录,我总是做小更改就提交,仓库有好多看起来很乱的 git没有可以把最后一个提交提交到服务器的能力,可以用rebase来做到把多个提交合并为一个。使用这个命令很简单,下面就来告诉大家如何使用这个命令
好了还是回到问题,我想把两个git合并
如果在 git 准备下载仓库的时候,出现下面的错误 cannot lock ref ‘refs/remotes/origin/xx’:’refs/remotes/origin/xx/xx’ exists cannot create ‘ref/remotes/origin/xx’ 那么请看本文,本文提供了一个解决方法。
参见:http://www.cnblogs.com/wpfworld/p/3181014.html
Problem description:
WPF will initialize pen thread when the window initializing. But I find the window may be locked in PenThreadWorker constructor.
The UnsafeNativeMethods.CreateResetEvent
will lock the thread.
Actual behavior: I use multithreading to create some windows by this code and maybe the thread be locked in PenThreadWorker constructor. The Demo code
public partial class App : Application
{
/// <inheritdoc />
protected override void OnStartup(StartupEventArgs e)
{
var thread = new Thread(() =>
{
var mainWindow = new MainWindow();
mainWindow.Show();
Dispatcher.Run();
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
base.OnStartup(e);
}
}
The step
Stylus Input
thread and show only a main window and the other main window and the thread be locked in PenThreadWorker constructor and the window can not show
Why I need multithreading to show the windows? I need the splash window to show the welcome page and then I should show the main window in other thread to do the bussiness code and I should close the splash window when the main window showed.
But I found some users could not show the main window and the main window be lock in PenThreadWorker constructor.
I use dnspy to suspend the application and find the code run in PenThreadWorker constructor and the UnsafeNativeMethods.CreateResetEvent
will lock the thread.
PenThreadWorker..ctor()
PenThread..ctor()
PenThreadPool.GetPenThreadForPenContextHelper(PenContext penContext)
PenThreadPool.GetPenThreadForPenContext(PenContext penContext)
WispTabletDeviceCollection.UpdateTabletsImpl()
WispTabletDeviceCollection.UpdateTablets()
WispTabletDeviceCollection..ctor()
WispLogic.get_WispTabletDevices()
WispLogic.RegisterHwndForInput(InputManager inputManager, PresentationSource inputSource)
HwndStylusInputProvider..ctor(HwndSource source)
HwndSource.Initialize(HwndSourceParameters parameters)
HwndSource..ctor(HwndSourceParameters parameters)
PresentationFramework.dll!System.Windows.Window.CreateSourceWindow(bool duringShow)
PresentationFramework.dll!System.Windows.Window.CreateSourceWindowDuringShow()
PresentationFramework.dll!System.Windows.Window.ShowHelper(object booleanBox)
Expected behavior:
The UnsafeNativeMethods.CreateResetEvent
do not lock the thread
Minimal repro:
Create a empty WPF application and then change the app.xaml.cs code
public partial class App : Application
{
/// <inheritdoc />
protected override void OnStartup(StartupEventArgs e)
{
var thread = new Thread(() =>
{
var mainWindow = new MainWindow();
mainWindow.Show();
Dispatcher.Run();
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
base.OnStartup(e);
}
}
Run the code and maybe you can find one of the main window can not show and it stop in UnsafeNativeMethods.CreateResetEvent
and I wait for a hour but it can not run.
本文记录我阅读 Avalonia 代码过程中所学习到的在 X11 的窗口之间发送鼠标消息,可以跨进程给其他进程的窗口发送鼠标消息,通过此方式可以实现模拟鼠标输入
本文将告诉大家如何在 WPF 里面,从键盘事件 KeyEventArgs 参数里获取到 Scan Code 键盘按键的设备独立标识符的方法
本文将告诉大家一个在 ZipArchive 里追加文件夹,以及添加过滤文件处理的压缩文件辅助方法
刚刚好 dotnet 8 的 glibc 版本足够旧,可以运行
本文记录使用 PulseAudio 在 Linux 系统上进行设置和获取当前音量,以及是否静音。当系统音量发生变更时,收到事件通知
本文将和大家介绍在 C# 里面简单使用 SharpFont 对 FreeType 的封装,读取 ttf 等字体文件信息,绘制出某个文字到图片文件
本文将从控制台开始,告诉大家一个非常简单的 WPF 基础绘图方法,通过本文的方法可以调用 WPF 上层人类友好的方法,充分利用 GPU 资源,创建或加工图片,最终结果可以输出到本地文件,可支持编码出多种不同的图片格式
大家都知道,在 dotnet 里面的可以使用 Environment.GetFolderPath 方法配合 Environment.SpecialFolder 枚举列出当前运行环境下的一些特殊文件夹。然而 SpecialFolder 枚举不包含对 Download 下载文件夹的枚举值,如咱需要获取用户当前的下载文件夹,需要使用 Win32 方法来辅助获取
本文告诉大家在 WPF 里面设置 SelectionTextBrush 无效的问题,可以通过 AppContext 的开关开启其行为
本文告诉大家如何在 GTK Sharp 里面设置窗口背景透明
本文将告诉大家如何在 C# dotnet 里面,从 GTK 里面获取到触摸的宽度高度信息,即触摸面积或触摸尺寸信息
本文将记录一个 C# dotnet 里的一个稍微隐藏的行为,那就是如果有一个结构体存在某个的方法,此方法的作用是修改结构里面的字段或属性的值,那此时将会在可空的结构体调用此方法时,发现没有真正修改到可空结构体局部变量本身
如果在 UNO 项目里面,为了进行 XAML 条件构建,将 win 平台加入到 mc:Ignorable 里面,将会在构建时提示 Xaml Internal Error error WMC9999: Unexpected ‘NONE’ in parse rule ‘Element ::= . EmptyElement ( StartElement ElementBody ).’. 错误
本文记录一个 UWP 或 WinUI3 的开发过程中的问题,当开发者调用 AddHandler 时,所需的 Handler 参数类型为 RoutedEventHandler 类型,然而实际上正确类型是需要与所监听事件匹配才能符合预期工作,否则将抛出缺乏信息的参数异常
本文记录一个 VisualStudio 黑科技,通过配置 DefaultXamlRuntime 属性,即可让非 WPF 或 WinUI 或 MAUI 等系列类型的项目也可以拥有 XAML 的智能提示,智能提示方式和 WinUI 智能提示行为相同
本文将和大家介绍 Pipelines.Sockets.Unofficial 这个由纯托管代码实现的,对接了 System.IO.Pipelines 的 Sockets 库。这个库不仅代码性能高,且上层调用的 API 足够简洁
本文记录 WPF 的一个已知问题,在 RepeatButton 上开启 IsManipulationEnabled 漫游支持之后,将会导致触摸长按到 RepeatButton 之上时,不会收到源源不断的 Click 事件
本文记录在 OpenXML SDK 2.15 版本下,为 PPTX 文件添加 CoreFilePropertiesPart 的方法,通过本文的方法可以正确且简单的添加 core.xml 文件到 PPTX 文件里
本文记录一个 UNO 已知问题,在 UNO 里面可以利用 SKXamlCanvas 对接 Skia 绘制到应用里面。如果此时在后台线程里面调用 SKXamlCanvas 的 Invalidate 触发界面的重新刷新,但在具体的执行绘制 PaintSurface 事件里面对外抛出异常,将会导致应用炸掉
官方现在只将中文注释维护到 .NET 5 版本,没有为 .NET 6 和 .NET 7 和 .NET 8 版本维护框架的中文注释。想要使用中文注释,需要使用第三方工具
当咱新建了一个 UNO 的基础库或被引用的项目时,可能采用的是默认的基础库或库项目创建方法,被引用的程序集没有带上 WinUI 的黑科技,导致构建提示 UNOB0002: Project XX contains a reference to Uno Platform but does not contain a WinAppSDK compatible target framework. 失败
本文记录一个简单的在 UNO.Skia.Gtk 应用里面,配置 GTK 平台修改窗口尺寸的方法
在 Intel 11 代锐炬 Intel® Iris® Xe Graphics 核显设备上,如果此设备使用旧版本驱动,则可能导致 WPF 的 WriteableBitmap 停止渲染。此问题和 WPF 无关,此问题是 Intel 的 bug 且最新驱动版本已修复
在带 Intel UHD 770 的设备上,使用旧版本驱动,即小于 30.0.101.1660 版本驱动,将会导致 WPF 的 3D 模块出现渲染异常。此问题和 WPF 无关,此问题是 Intel 的 bug 且最新驱动版本已修复
本文记录一个 WPF 已知问题,当传入到渲染的 Geometry 几何里面包含了 NaN 数值,将可能让应用程序收到从渲染层抛上来的 UCEERR_RENDERTHREADFAILURE 异常,且此异常缺乏必要信息,比较难定位到具体错误逻辑
远古的 WPF 框架开发的大佬们认为没有任何业务的开发者需要用到超过 65534 个依赖属性和附加属性,为了节省内存空间就限制了所有的依赖属性和附加属性的定义总和加起来不能大于等于 65535 个
本文将告诉大家如何在 UNO 里面将界面的层级结构输出到调试窗口
本文将和大家介绍在什么情况下 WPF 将会在调用 VisualTreeHelper.GetDescendantBounds 方法时,返回一个无穷大的范围尺寸