小编And*_*sen的帖子

在使用条件断点和立即窗口时获取"无法评估安全功能"

在开发.NET Core 2.0应用程序时,我遇到了条件断点,监视评估和即时窗口评估的问题.我收到以下错误:

modifiers.GroupBy(c => c.Modifier.Group).ToList()
抛出类型'System.ArgumentException'的异常
数据:{System.Collections.ListDictionaryInternal}
HResult:-2147024809
HelpLink:null
InnerException:null
消息:"无法评估安全功能."
ParamName:null
源:null
StackTrace:null
TargetSite:null

什么可能导致这个问题?有解决方法吗?这在.NET Framework 4.x应用程序中运行良好.


编辑:添加代码示例

使用以下类:

public class Person
{
    public string Name { get; set; }
    public int Age { get; set; }
    public string Group { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

在正常的控制台应用程序中,以.NET Core 2.0为目标:

static void Main(string[] args)
{
    var people = new List<Person>
    {
        new Person { Age = 17, Name = "Person A", Group = "Group A" },
        new Person { …
Run Code Online (Sandbox Code Playgroud)

.net c# .net-core

21
推荐指数
1
解决办法
3714
查看次数

Azure DocumentDB上的性能降低

我目前面临来自Azure DocumentDB的响应时间非常慢(第一次尝试).

集合中有31个对象,我将要获取并返回给调用者.我使用的代码是这样的:

public async Task<List<dynamic>> Get(string collectionName = null)
{
    // Lookup from Dictionary, takes literally no time
    var collection = await GetCollectionAsync(collectionName);

    var sw = Stopwatch.StartNew();

    var query = await
        _client.CreateDocumentQuery(collection.DocumentsLink, 
            new FeedOptions { MaxItemCount = 1000 })
            .AsDocumentQuery()
            .ExecuteNextAsync();

    Trace.WriteLine($"Get documents: {sw.ElapsedMilliseconds} ms");

    return query.ToList();
}
Run Code Online (Sandbox Code Playgroud)

要实例化客户端,我使用以下代码:

_client = new DocumentClient(new Uri(endpoint), authKey, new ConnectionPolicy
{
    ConnectionMode = ConnectionMode.Direct,
    ConnectionProtocol = Protocol.Tcp
});
Run Code Online (Sandbox Code Playgroud)

我从中获取的响应时间Stopwatch在360ms到1200ms之间,以返回31个对象.对我来说,这慢.没有自定义ConnectionPolicy ,平均响应时间约为950毫秒.

我在这里做错了吗?有可能以某种方式加快这些要求吗?

以下是Trace的输出,打印出秒表的经过时间:

Get documents: 1984 ms
Get …
Run Code Online (Sandbox Code Playgroud)

.net c# azure azure-cosmosdb

19
推荐指数
1
解决办法
9385
查看次数

Windows Azure Web角色缓存(预览)"挂起"使模拟器卡在部署循环中

我正在尝试使用Microsoft网站上的指南,将2012年6月SDK版本中引入的新发布的基于角色的缓存替换为Windows Azure AppFabric缓存.

但是,在我的Web角色中检查"启用缓存(预览)"时,模拟器将无法成功实例化网站(模拟器日志:http://pastebin.com/dwbDvak2).它似乎陷入了某种循环.禁用Web角色缓存使其再次起作用.卸载所有以前的Azure SDK并重新安装1.7版本后,我得到了相同的结果.

Visual Studio告诉我"角色实例开始的时间比预期的要长.你想继续等待吗?" [是] [否].按是保持等待,并反复出现.

是否有人可能知道如何解决上述问题,或者可能尝试过新的Web角色缓存功能并让它在azure模拟器中工作?

azure本地调试环境部署对话框的屏幕截图

谢谢.

更新:

我创建了一个新的解决方案,并添加了一个简单的MVC站点,添加了Web角色并启用了缓存,并且发生了同样的事情.所以,我看了一下事件查看器,发现了3个与该问题相关的条目:

Fault bucket 3034750239, type 5
Event Name: CLR20r3
Response: Not available
Cab Id: 0

Problem signature:
P1: cacheinstaller.exe
P2: 1.0.4655.0
P3: 4fb0f3f9
P4: CacheInstaller
P5: 1.0.4655.0
P6: 4fb0f3f9
P7: 11
P8: 47
P9: System.TypeLoadException
P10: 

Attached files:
C:\Users\anan\AppData\Local\Temp\WEREA8F.tmp.WERInternalMetadata.xml

These files may be available here:
C:\Users\anan\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_cacheinstaller.e_1fbc3b72afb6acf93335ca8611850d289906c25_2ddaf529

Analysis symbol: 
Rechecking for solution: 0
Report Id: 3138ba06-b344-11e1-a8d6-402cf41c1e07
Report Status: 0


Application: CacheInstaller.exe
Framework …
Run Code Online (Sandbox Code Playgroud)

.net azure azure-web-roles azure-caching

5
推荐指数
1
解决办法
3005
查看次数

netstandard - 正则表达式,组名无法访问

在.NET Core和.NET Framework 4.x中,以下代码按预期工作:

var match = Regex.Match(src, pattern)
    .Groups
    .Cast<Group>()
    .Where(grp => grp.Name.StartsWith("val"));
Run Code Online (Sandbox Code Playgroud)

然而,在netstandard,Name财产Group已经消失.我想知道是否有一种新的方式来实现同样的事情,或者这是一个错误.


编辑:我首先认为这是一个netstandard 2.0问题,但看起来所有netstandard版本都缺少该属性.

现在的解决方法: .Where(grp => ((string)((dynamic)grp).Name).StartsWith("val"))显然不太理想.

c# .net-standard

4
推荐指数
1
解决办法
490
查看次数

查找重复项并使用第一个找到的重复项的 ID 标记重复项

我有一个名为 的表log,其中有数百万行。目前,它看起来像这样:

Id       OriginId MetricId  Value  IsDuplicate DuplicateId
-------- -------- --------- ------ ----------- -----------
1        50ECC7F6 FC7A477F  2.00   0           0
3        50ECC7F6 FC7A477F  2.00   0           0
4        8800B985 7F438F09  5.00   0           0
5        50ECC7F6 FC7A477F  2.00   0           0
Run Code Online (Sandbox Code Playgroud)

我现在需要找到OriginIdMetricId相等的重复项,将除第一个匹配项之外的所有匹配项设置IsDuplicate为 1,并DuplicateId设置为Id第一个出现的行的 。

预期的结果是这样的:

Id       OriginId MetricId  Value  IsDuplicate DuplicateId
-------- -------- --------- ------ ----------- -----------
1        50ECC7F6 FC7A477F  2.00   0           0
3        50ECC7F6 FC7A477F  0.00   1           1
4        8800B985 …
Run Code Online (Sandbox Code Playgroud)

t-sql sql-server sql-update

0
推荐指数
1
解决办法
474
查看次数