我想以不同的方式防止这种情况发生,而不是将DateCreated的类型设置为可为空的DateTime.
完整的异常如下所示:
转换为值类型'System.DateTime'失败,因为具体化值为null.结果类型的泛型参数或查询必须使用可空类型.
当我在数据库上运行以下查询时,我可以看到那里没有空记录,所以我相信我应该避免将DateCreate属性设置为可以为空的DateTime,因为它对我没有多大意义(即使我知道它会解决问题).有什么我理解错了吗?

查询的以下行导致问题:
DateCreated = subJoined.dateUploaded
Run Code Online (Sandbox Code Playgroud)
这是完整的LINQ查询:
using (var db = new ABEntities())
{
var features = (from textObject in db.textObjects
join container in db.containers.DefaultIfEmpty() on textObject.textObjectPK equals
container.textObjectPK into tObjsContainerJoined
from subContainerJoin in tObjsContainerJoined.DefaultIfEmpty()
join tObjsMedia in db.media on subContainerJoin.mediaID equals
tObjsMedia.mediaID into tObjsMediaJoined
from subJoined in tObjsMediaJoined.DefaultIfEmpty()
from textContainer in tObjsContainerJoined
where
textObject.version == Constants.Versions.LATEST &&
textObject.textObjectTypeID == Constants.News.FEATURES &&
textObject.deployDate <= DateTime.Now
select new TextObject
{
Id = textObject.textObjectID,
Title = textObject.title,
ContainerId = textContainer.containerID, …Run Code Online (Sandbox Code Playgroud) 有时当我试图创建模糊的位图时,我得到"空指针异常".
发生在这个代码块中(我最近开始捕获异常,所以至少它不会崩溃应用程序):
try
{
using (Bitmap.Config config = Bitmap.Config.Rgb565) {
return Bitmap.CreateBitmap (blurredBitmap, width, height, config);
}
}
catch (Java.Lang.Exception exception)
{
Util.Log(exception.ToString());
}
Run Code Online (Sandbox Code Playgroud)
有关我传递给"CreateBitmap"方法的参数的更多详细信息,请参阅这些图片:
这是扩展的参数:
完全例外:
exception {Java.Lang.NullPointerException:抛出了类型'Java.Lang.NullPointerException'的异常.在/Users/builder/data/lanes/2058/58099c53/source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61中的System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()[0x0000b]在Android.Runtime.JNIEnv.CallStaticObjectMethod(IntPtr jclass,IntPtr jmethod,Android.Runtime.JValue*parms)[0x00064] in /Users/builder/data/lanes/2058/58099c53/source/monodroid/src/Mono.Android/ src/Runtime/JNIEnv.g.cs:1301位于/ Users/builder/data中的Android.Graphics.Bitmap.CreateBitmap(System.Int32 []颜色,Int32宽度,Int32高度,Android.Graphics.Config配置)[0x00088] /lanes/2058/58099c53/source/monodroid/src/Mono.Android/platforms/android-22/src/generated/Android.Graphics.Bitmap.cs:
不确定这可能是Xamarin中的错误还是传递的参数错误.
我知道在 Android 上,您可以使用NotificationListenerService检索当前活动通知的列表。但是,是否可以检索旧通知列表(意味着不再处于活动状态)。
我知道 Android 操作系统中有一项名为Notification Log 的功能。是否可以仅针对我的应用程序获得相同的内容?或者这是否必须在应用程序级别处理以保留那种历史?
我无法以标准化的方式在重复编辑器中隐藏一个选项.我试图通过自定义代码隐藏它,但它有时会产生不可预测的行为.
这就是我想隐藏的内容:

我对 .NET Framework 中包含但也可在 Nuget 上使用的这两个库感到非常困惑。我的直觉是使用 Nuget 一个,因为我会得到更频繁的更新等。但是,即使我引用了 nuget 中的一个,Visual Studio msbuild 也使用了位于以下位置的 .NET 框架中的一个:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net461\lib
Run Code Online (Sandbox Code Playgroud)
我在 github 上找到的一种解决方法是从 msbuild 文件夹中删除这些库。但是每当我更新 VS Studio 时,它都会将它们带回那里。nuget 包还引入了一些绑定重定向。我无法计算有多少次构建正常,然后 Xth 构建给出了一个错误,对于这些程序集来说毫无意义。
您是否建议删除 nuget 包并使用框架中包含的包?
在我们的Xamarin Android项目中,我们试图从sqlite-net切换到官方的sqlite-net-pcl包.
但是在创建新的SQLiteConnection后进行此切换后,我遇到以下异常:
'SQLite.SQLiteConnection'的类型初始值设定项引发了异常.---> System.DllNotFoundException:e_sqlite3
完全例外:
Xamarin引起的:android.runtime.JavaProxyThrowable:System.TypeInitializationException:'SQLite.SQLiteConnection'的类型初始值设定项引发异常.---> System.DllNotFoundException:e_sqlite3 at(wrapper managed-to-native)SQLitePCL.SQLite3Provider_e_sqlite3 + NativeMethods:siteite3_libversion_number()at SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion_number()[0x00000] in:0 at SQLitePCL.raw. SQL4中的Setitevider(SQLitePCL.ISQLite3Provider imp)[0x00000]:SQLitePCL.Batteries_V2.Init()[0x0000d]中的<1125db7e18f0475797b2764ec6653cf1>:0中的/,/ Users/fak中的SQLite.SQLiteConnection..cctor()[0x00000]中的0 /Dropbox/Projects/sqlite-net/src/SQLite.cs:171 ---内部异常堆栈跟踪结束---在mono.android.view.View_OnClickListenerImplementor上的mono.android.view.View_OnClickListenerImplementor.n_onClick(本机方法) .onClick(View_OnClickListenerImplementor.java:30)在android.view.View.performClick(View.java:4780)的android.view.View $ PerformClick.run(View.java:19866)android.os.Handler.handleCallback( Handler.java:739)在android.os.Handler.dispatchMessage(Handler.jav a:95)在android.app.Looper.loop(Looper.java:135)的android.app.ActivityThread.main(ActivityThread.java:5254)java.lang.reflect.Method.invoke(Native Method)at java位于com.android.internal.os.ZygoteInit.main的com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:903)中的.lang.reflect.Method.invoke(Method.java:372)(ZygoteInit)的.java:698)
在日志中我可以看到以下信息:
12-01 10:43:05.356 D/Mono(11194):DllImport试图加载:'e_sqlite3'.12-01 10:43:05.358 D/Mono(11194):DllImport错误加载库'/storage/emulated/0/Android/data/com.psonar.android/files/.覆盖/libe_sqlite3' :"dlopen的失败:库"/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/ 覆盖/libe_sqlite3"找不到".12-01 10:43:05.360 D/Mono(11194):DllImport错误加载库'/storage/emulated/0/Android/data/com.psonar.android/files/.override /libe_sqlite3.so':'dlopen failed:library"/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.覆盖 /libe_sqlite3.so"未找到".12-01 10:43:05.360 D/Mono(11194):DllImport错误加载库'/ system/lib/libe_sqlite3':'dlopen failed:library"/data/app/com.psonar.android-1/lib/x86 // system/lib/libe_sqlite3"找不到".12-01 10:43:05.360 D/Mono(11194):DllImport错误加载库'/system/lib/libe_sqlite3.so':'dlopen failed:library"/data/app/com.psonar.android-1/lib /x86//system/lib/libe_sqlite3.so"未找到".12-01 10:43:05.360 D/Mono(11194):DllImport错误加载库'libe_sqlite3':'dlopen failed:library"/data/app/com.psonar.android-1/lib/x86/libe_sqlite3"未找到".12-01 10:43:05.361 D/Mono(11194):DllImport错误加载库'libe_sqlite3.so':'dlopen failed:library"/data/app/com.psonar.android-1/lib/x86/libe_sqlite3.所以"没找到".12-01 10:43:05.361 D/Mono(11194):DllImport错误加载库'e_sqlite3':'dlopen failed:library"/data/app/com.psonar.android-1/lib/x86/e_sqlite3"未找到".12-01 10:43:05.362 D/Mono(11194):DllImport错误加载库'/storage/emulated/0/Android/data/com.psonar.android/files/.覆盖/libe_sqlite3' :"dlopen的失败:库"/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/ 覆盖/libe_sqlite3"找不到".12-01 10:43:05.364 D/Mono(11194):DllImport错误加载库'/storage/emulated/0/Android/data/com.psonar.android/files/.override /libe_sqlite3.so':'dlopen failed:library"/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.覆盖 …
android xamarin.android xamarin sqlite-net sqlite-net-extensions
我正在为 Orchard 开发一个自定义模块。我想在我的自定义模块中的一个页面上使用一个小部件。
如何将小部件添加到页面(将其显示为局部视图?如何引用它?)?
目标是将主页创建为模块,当您激活它时,它将具有 Item Slider Widget 的所有功能 - http://gallery.orchardproject.net/List/Modules/Orchard.Module.FeaturedItemSlider。所以小部件将位于页面的内容部分。
谢谢
在Orchard中添加新内容时可以以某种方式隐藏"设置为主页"复选框(不删除Autoroute部分)吗?
谢谢,
的Jakub
我有一个数据库,其中包含通过cfusion_encrypt()加密的用户密码.我需要为C#中的ColdFusion代码做一个登录替代.有没有简单的方法如何在C#中模拟这个,这样我就可以比较用户密码的加密值并将它们与ColdFusion值匹配?
我们将应用程序部署到Azure。它正在使用Azure Redis缓存,并且我们遇到了很多超时。即:
[TimeoutException: Timeout performing GET textobjectDetails__23290_TextObject, inst: 1, mgr: Inactive, queue: 5, qu=0, qs=5, qc=0, wr=0/0, in=56864/0]
[TimeoutException: Timeout performing GET featured_series_CachedSeries, inst: 1, mgr: Inactive, queue: 4, qu=0, qs=4, qc=0, wr=0/0, in=44470/0]
[TimeoutException: Timeout performing GET SeriesByFranchiseId_1_CachedSeries, inst: 1, mgr: Inactive, queue: 3, qu=0, qs=3, qc=0, wr=0/0, in=11252/0]
[TimeoutException: Timeout performing GET media_silo-1-1-0_Media, inst: 1, mgr: Inactive, queue: 3, qu=0, qs=3, qc=0, wr=0/0, in=15188/0]
[TimeoutException: Timeout performing GET textobjectDetails__3092_TextObject, inst: 3, mgr: Inactive, queue: 7, qu=0, qs=7, qc=0, …Run Code Online (Sandbox Code Playgroud) 我们在Swagger项目中使用Web API 2。我的问题是,当Microsoft.AspNet.WebApi.Versioning应用如下:
该扬鞭UI被忽略的事实是,现在我在的API,它需要提供具有版本。
我看了几个例子,但似乎没有一个能以令人满意的方式解决这个问题。
如何强制 Swagger 让我添加 API 版本或仅将版本号自动添加到 URL?
到目前为止的 Swagger 配置:
GlobalConfiguration.Configuration
.EnableSwagger(c =>
{
c.SingleApiVersion("v1", "MoovShack.ServerApi");
// If your API has multiple versions, use "MultipleApiVersions" instead of "SingleApiVersion".
// In this case, you must provide a lambda that tells Swashbuckle which actions should be
// included in the docs for a given API version. Like "SingleApiVersion", each call to "Version"
// returns an "Info" builder so you can …Run Code Online (Sandbox Code Playgroud) c# ×5
android ×3
orchardcms ×2
xamarin ×2
azure ×1
bitmap ×1
caching ×1
coldfusion ×1
kendo-ui ×1
module ×1
msbuild ×1
nuget ×1
recurrence ×1
redis ×1
sqlite-net ×1
swagger ×1
swagger-ui ×1
widget ×1