使用最新的net6.0,在windows10上面运行一切正常,跑到windows7里面去初始化都会失败!
第一行代码就出错: keHuDuan.StartTime = DateTime.Now.ToLocalTime().ToString();
错误提示:system.typeinitializationexception: the type initialirer for system.datetime threw an exception
找到原因了,是因为Windows7没有更新,将windows7更新后,就能正常运行了!
win7对这个可能是不兼容或者是版本不匹配。
以上仅供参考,如有任何疑问,可以评论回复,看到即回。
希望对题主有所帮助!可以的话,点个采纳!