小编bfa*_*ahm的帖子

.NET Core 中的 ConfigurationManager.GetConfigurationAsync(CancellationToken cancel) 取消了任务

我有两个项目,一个在.NET 5上,另一个在.NET Core 3.1上。

\n

最近,我打开了电子邮件日志记录,每当抛出错误时都会向我发送电子邮件。

\n

我时不时地收到一封包含以下错误的电子邮件:

\n
[Error] An unhandled exception has occurred while executing the request.\nSystem.Threading.Tasks.TaskCanceledException: A task was canceled.\n   at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)\n   at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()\n   at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()\n   at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()\n   at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)\n   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\n   at Serilog.AspNetCore.RequestLoggingMiddleware.Invoke(HttpContext httpContext)\n   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)\n\n
Run Code Online (Sandbox Code Playgroud)\n

问题是,该错误永远不会在本地开发环境中抛出,并且它可能对应于某些网络不稳定,但我不确定从哪里开始寻找

\n

对于跨应用程序的配置,我使用以下初始化来允许将 AppSettings 对象注入到任何类:

\n
[Error] An unhandled exception has occurred while executing the request.\nSystem.Threading.Tasks.TaskCanceledException: A task was canceled.\n   at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)\n …
Run Code Online (Sandbox Code Playgroud)

c# .net-core asp.net-core identityserver4 .net-5

5
推荐指数
0
解决办法
993
查看次数

虽然我可以使用 MaterialButton,但不能使用 MaterialButtonToggleGroup?

我想在我的应用程序中实现这种外观: 看

我在活动中的 xml 代码看起来像这样:

<com.google.android.material.button.MaterialButtonToggleGroup
  android:id="@+id/toggleGroup"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content">

  <com.google.android.material.button.MaterialButton
    android:id="@+id/button1"
    ... />

  <com.google.android.material.button.MaterialButton
    android:id="@+id/button2"
    ... />

  <com.google.android.material.button.MaterialButton
    android:id="@+id/button3"
    ... />
</com.google.android.material.button.MaterialButtonToggleGroup>
Run Code Online (Sandbox Code Playgroud)

我迁移到 androidx,并在我的样式中使用了材质组件,但由于某种原因,我收到一个运行时错误,内容为:

Binary XML file: Error inflating class com.google.android.material.button.MaterialButtonToggleGroup

implementation "com.google.android.material:material:1.0.0"
Run Code Online (Sandbox Code Playgroud)

不过,在com.google.android.material.button.MaterialButton没有组的情况下使用时,它会工作得很好,这意味着我使用了正确的样式和 gradle 实现。

我还尝试以下操作:

  • 使缓存失效
  • 删除并重新导入androidx.appcompat:appcompat:1.1.0com.google.android.material:material:1.0.0多次
  • 关闭和重新打开android studio
  • 关闭项目后重新导入项目
  • 将 minSdkVersion 提升为 21 而不是 14(目标和编译 sdk 版本都是 28)

这是我的依赖项(以防其中一些导致某种冲突):

implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

    implementation 'androidx.cardview:cardview:1.0.0'

    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

    //Room Persistance Library
    def …
Run Code Online (Sandbox Code Playgroud)

java android android-studio material-components-android

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

Android-具有CHIPS风格的自定义标签布局?

如何在标签中获得这种外观?
描述我需要的样式的图像

我希望它:

•根据查看的页面更改文本的颜色(我已经通过默认的supportLibrary的Widget TabLayout实现了此功能)
•更改了背景笔触的颜色
•每个选项卡元素之间都有间距(无法通过padding选项实现)

我搜索了图书馆吗,但没有任何有用的细节,实际上,我不知道在搜索栏中键入什么内容。
这种风格的名称是什么?

提前致谢。

tabs android android-layout android-fragments android-studio

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