小编Luk*_*keN的帖子

WPF渲染线程挂起

我在wpf应用程序中遇到问题,其中渲染线程停止渲染,但UI线程和帮助程序线程仍在抽取消息.

它似乎与演示字体缓存的损坏有关,但这似乎不太可能,因为应用程序在重新启动时恢复正常.

渲染线程偶尔会挂起,阻止绘图更新,但UI线程仍在处理消息.

我们已经看到了在将缩放变换应用于通过删除字体缓存解决的文本块时出现的类似问题(类似于此处),但是这个特定问题不可靠地重复.

诊断此问题根本原因的最佳方法是什么?

我在连接时打开了微软的一个错误,但除非其他人投票,否则不会考虑它.

wpf rendering hang

24
推荐指数
1
解决办法
3045
查看次数

从脚本模块中的嵌套模块调用函数并不总是触发模块自动加载

如果我使用嵌套模块创建清单模块,则在第一个之后的所有嵌套模块中的导出函数不会出现在可用命令列表中,并且不会触发模块自动加载.

当我运行"Get-Module -ListAvailable"时,它们也不会出现.

只有第一个嵌套模块中的导出函数才会出现在命令列表中.

如果我明确导入模块,则所有导出的函数都可用.

在下面的示例中,在显式导入模块之前,Update-LegacyServices不可用.

我可以使它的唯一方法是将我的模块文件重命名为ps1而不是psm1,并将它们包含在ScriptsToProcess中,这似乎是一个坏主意.

模块清单(psd1)

@{

# Script module or binary module file associated with this manifest.
# RootModule = ''

# Version number of this module.
ModuleVersion = '1.0.0.1'

# ID used to uniquely identify this module
GUID = 'c11d6aca-d531-4d06-a732-5fb95113357f'

# Author of this module
Author = 'luke'

# Company or vendor of this module
CompanyName = ''

# Copyright statement for this module
Copyright = ''

# Description of the functionality provided by this module …
Run Code Online (Sandbox Code Playgroud)

powershell

8
推荐指数
1
解决办法
5407
查看次数

从实现者调用接口扩展方法在C#中很奇怪

调用在实现者的接口上工作的扩展方法似乎需要使用this关键字.这看起来很奇怪.

有谁知道为什么?

有没有更简单的方法来获得接口的共享实现?

当我遭受多重继承/混合撤销时,这让我感到烦恼.

玩具示例:

public interface ITest
{
    List<string> TestList { get; }
}

public static class TestExtensions
{
    private const string Old = "Old";
    private const string New = "New";

    public static void ManipulateTestList(this ITest test)
    {
        for (int i = 0; i < test.TestList.Count; i++)
        {
            test.TestList[i] = test.TestList[i].Replace(Old, New);
        }
    }
}

public class Tester : ITest
{
    private List<string> testList = new List<string>();
    public List<string> TestList
    {
        get { return testList; }
    }

    public Tester() …
Run Code Online (Sandbox Code Playgroud)

c# extension-methods multiple-inheritance mixins

6
推荐指数
1
解决办法
157
查看次数