-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
string ordersn = tb_goods.Text;
if (ordersn.Contains("-") == false)
{
MessageBox.Show("Please enter the correct order number!");
return;
}
if (string.IsNullOrEmpty(tb_goods.Text))
{
MessageBox.Show("Please enter the correct order number");
return;
}
//var gf = await OrderDb.CheckOrderInfo(ordersn);
this.BeginInvoke(new Action(() =>
{
this.ShowMsg("Querying order information, please wait...");
}));
//SQLite database query
var gf = await Task.Run(() => OrderDb.CheckOrderInfo(ordersn));
//var gf=await OrderDb.CheckOrderInfo(ordersn);
if (gf != null)
{
//there had error when FormHome show!
new FormHome(66, $"{baseUrl}{ordersn}").Show();
return;
}
MessageBox.Show("Order not stored!");In the above code, if I set
//var gf=await OrderDb. CheckOrderInfo (ordersn); Annotate it to open FormHome normally. FormHome has using webview2 control.
If I don't annotate it, the following error will occur
The state of the group or resource is not the correct state to perform the requested operation. (Exception from HRESULT: 0x8007139F)
The location of the error is
await this.EnsureCoreWebView2Async(ev);var gf=await OrderDb. CheckOrderInfo (ordersn) It is a normal database query method, and it is correct without any issues
Note:OrderDb. CheckOrderInfo class have using interface
Importance
Important. My app's user experience is significantly compromised.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
1.0.3344.0
SDK Version
1.0.3344.0
Framework
Winforms
Operating System
Windows 10, Windows 11
OS Version
No response
Repro steps
public class OrderDb
{
public static async Task<GoodsInfo> CheckGoodsInfo(string goodsIdOrSn)
{
if (Common.Pd_Soft==0)
{
if (Common.DbSrc.Count == 0)
{
MessageBox.Show("the path is error!!");
return null;
}
var gf= await PT_CheckGoodsInfo(goodsIdOrSn, 0);
if(gf==null && Common.DbSrc.Count==2)
{
gf =await PT_CheckGoodsInfo(goodsIdOrSn, 1);
}
return gf;
}
else
{
IDbFace db = GetDbContext();
if (db == null) return null;
GoodsInfo gf =await OtherCheckGoodsInfo(db,goodsIdOrSn);
if(gf!=null)
{
gf.PddMallId = FixMallID(gf.PddMallId);
}
return gf;
}
}
private static IDbFace GetDbContext()
{
IDbFace db = null;
if (Common.Pd_Soft == 1)
{
db = new MfsDb();
}
else if (Common.Pd_Soft == 2)
{
db = new DDDb();
}
else if (Common.Pd_Soft == 3)
{
db = new MryDb();
}
return db;
}
public static async Task<GoodsInfo> CheckOrderInfo(string OrderSn)
{
if (Common.Pd_Soft == 0)
{
if (Common.DbSrc.Count == 0)
{
MessageBox.Show("the path is error!");
return null;
}
var gf = await PT_CheckOrderInfo(OrderSn, 0);
if (gf == null && Common.DbSrc.Count == 2)
{
gf =await PT_CheckOrderInfo(OrderSn, 1);
}
return gf;
}
else
{
IDbFace db = GetDbContext();
GoodsInfo gf =await OtherCheckOrderInfo(db, OrderSn);
if (gf != null)
{
gf.PddMallId = FixMallID(gf.PddMallId);
}
return gf;
}
}
public static string FixMallID(string mid)
{
if (string.IsNullOrEmpty(mid)) return mid;
return mid.Replace("pdd", "").Substring(0, 9);
}
private static async Task<GoodsInfo> OtherCheckGoodsInfo(IDbFace db,string goodsIdOrSn)
{
if (db == null)
{
return null;
}
GoodsInfo gf =await db.GetGoodsAndMallInfo(goodsIdOrSn);
return gf;
}
private static async Task<GoodsInfo> OtherCheckOrderInfo(IDbFace db, string goodsIdOrSn)
{
if (db == null)
{
return null;
}
GoodsInfo gf =await db.GetSaleAndMallInfo(goodsIdOrSn);
return gf;
}
private static async Task<GoodsInfo> PT_CheckGoodsInfo(string goodsIdOrSn,int index)
{
PTV2 db = Db.PTV2.InitDB(Common.DbSrc[index].path, Common.DbSrc[index].type);
if (db == null)
{
return null;
}
var gf =await db.GetGoodsAndMallInfo(goodsIdOrSn);
return gf;
}
private static async Task<GoodsInfo> PT_CheckOrderInfo(string OrderSn, int index)
{
PTV2 db = Db.PTV2.InitDB(Common.DbSrc[index].path, Common.DbSrc[index].type);
if (db == null)
{
return null;
}
GoodsInfo gf =await db.GetSaleAndMallInfo(OrderSn);
return gf;
}
}
public interface IDbFace
{
// static T InitDB();
Task<GoodsInfo> GetGoodsAndMallInfo(string gidOrSn);
Task<GoodsInfo> GetSaleAndMallInfo(string gidOrSn);
}Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
Don't know
Last working version (if regression)
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
