Issue with Net 5.0

Discussion of chess software programming and technical issues.

Moderator: Ras

Chessnut1071
Posts: 313
Joined: Tue Aug 03, 2021 2:41 pm
Full name: Bill Beame

Issue with Net 5.0

Post by Chessnut1071 »

Okay, I see the advantage of bit boards, at least on pseudo move generation; however, Net 3.0 doesn't support bit scan forward. So, I took the advice of some on this board and target Net 5.0. I got the intrinsic bit operations working and it runs 9.9x faster than my code work around. The problem is Net 5.0 doesn't update my labels and the WPF doesn't support some of my Win forms code. I need the speed, but, I also need my graphics and forms code. Am I missing an assembly or namespace? It seems like 100s of other programmers are having the same issue with Net 5.0. Does Net 6.0 have better support for Win Forms?
dangi12012
Posts: 1062
Joined: Tue Apr 28, 2020 10:03 pm
Full name: Daniel Infuehr

Re: Issue with Net 5.0

Post by dangi12012 »

Again for Chessnut: Bitscanforward (ie TrailingZeroCount) could be used since Visual Studio 2015 and .net framework. For Core its also there:
System.Runtime.Intrinsics.X86.Bmi1.X64.TrailingZeroCount(value);
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
R. Tomasi
Posts: 307
Joined: Wed Sep 01, 2021 4:08 pm
Location: Germany
Full name: Roland Tomasi

Re: Issue with Net 5.0

Post by R. Tomasi »

Chessnut1071 wrote: Mon Dec 13, 2021 5:44 am WPF doesn't support some of my Win forms code.
That's odd. You should be able to just host any system.windows.forms form with the WindowsFormsHost WPF control. If you can't load your form within a WPF host, that may be because you use different frameworks for the assembly containing the form and the WPF assembly.
dangi12012
Posts: 1062
Joined: Tue Apr 28, 2020 10:03 pm
Full name: Daniel Infuehr

Re: Issue with Net 5.0

Post by dangi12012 »

Chessnut1071 wrote: Mon Dec 13, 2021 5:44 am Okay, I see the advantage of bit boards, at least on pseudo move generation; however, Net 3.0 doesn't support bit scan forward. So, I took the advice of some on this board and target Net 5.0. I got the intrinsic bit operations working and it runs 9.9x faster than my code work around. The problem is Net 5.0 doesn't update my labels and the WPF doesn't support some of my Win forms code. I need the speed, but, I also need my graphics and forms code. Am I missing an assembly or namespace? It seems like 100s of other programmers are having the same issue with Net 5.0. Does Net 6.0 have better support for Win Forms?
https://docs.microsoft.com/en-us/dotnet ... esktop-4.8
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
Chessnut1071
Posts: 313
Joined: Tue Aug 03, 2021 2:41 pm
Full name: Bill Beame

Re: Issue with Net 5.0

Post by Chessnut1071 »

dangi12012 wrote: Mon Dec 13, 2021 3:20 pm
Chessnut1071 wrote: Mon Dec 13, 2021 5:44 am Okay, I see the advantage of bit boards, at least on pseudo move generation; however, Net 3.0 doesn't support bit scan forward. So, I took the advice of some on this board and target Net 5.0. I got the intrinsic bit operations working and it runs 9.9x faster than my code work around. The problem is Net 5.0 doesn't update my labels and the WPF doesn't support some of my Win forms code. I need the speed, but, I also need my graphics and forms code. Am I missing an assembly or namespace? It seems like 100s of other programmers are having the same issue with Net 5.0. Does Net 6.0 have better support for Win Forms?
https://docs.microsoft.com/en-us/dotnet ... esktop-4.8
FRUSTRATION!
Been there, done that, have the t-shirt. I still get the same error: Net 5.0 C# Wpf

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Numerics;

using WindowsFormsIntegration;CSO246 error Type or namespace WindowsFormsIntegration could not be found
using System.Windows.Forms; CSO234 error: Type or namespace "Forms" does not exist in the namespace System.Windows

namespace WpfApp2
{

.....

}

Perhaps Net 5.0 doesn't like me.
User avatar
leanchess
Posts: 181
Joined: Sun Dec 08, 2019 8:16 pm
Full name: Dmitry Shechtman

Re: Issue with Net 5.0

Post by leanchess »

Chessnut1071 wrote: Mon Dec 13, 2021 5:14 pm using WindowsFormsIntegration;CSO246 error Type or namespace WindowsFormsIntegration could not be found
using System.Windows.Forms; CSO234 error: Type or namespace "Forms" does not exist in the namespace System.Windows

namespace WpfApp2
{

.....

}

Perhaps Net 5.0 doesn't like me.
The namespace should be System.Windows.Forms.Integration.

You're probably missing a framework reference to WindowsFormsIntegration (and to System.Windows.Forms, apparently).
Chessnut1071
Posts: 313
Joined: Tue Aug 03, 2021 2:41 pm
Full name: Bill Beame

Re: Issue with Net 5.0

Post by Chessnut1071 »

R. Tomasi wrote: Mon Dec 13, 2021 11:20 am
Chessnut1071 wrote: Mon Dec 13, 2021 5:44 am WPF doesn't support some of my Win forms code.
That's odd. You should be able to just host any system.windows.forms form with the WindowsFormsHost WPF control. If you can't load your form within a WPF host, that may be because you use different frameworks for the assembly containing the form and the WPF assembly.
Status: bit scan forward is working fine in Net 5.0; However, my labels are not updating on the Grid. It seems my program can no longer update, or refresh, like I could in Windows Forms. I think this is a WPF issue which probably has a simple solution. There are no errors or warnings, just no update to the labels I use for debugging. Net 5.0 is brand new to me and you can no longer refresh a control in WFP. I would go back to my Windows forms, but, the intrinsic bit operations are over 9x faster than my C# code work around. It seems like 100s of other programmers are having similar issues, most converting to Net 5.0 from earlier version too. This seems so simple, how do you refresh controls in WPF?
spirch
Posts: 95
Joined: Fri Nov 09, 2012 12:36 am

Re: Issue with Net 5.0

Post by spirch »

stop using 5.0

start using 6.0
Chessnut1071
Posts: 313
Joined: Tue Aug 03, 2021 2:41 pm
Full name: Bill Beame

Re: Issue with Net 5.0

Post by Chessnut1071 »

spirch wrote: Tue Dec 14, 2021 1:30 pm stop using 5.0

start using 6.0
Okay, got it working in Net 6.0, including trailing zeros and the rest of the intrinsic bit operations. Net 5.0 drove me bananas. Thx for all the responses.
Chessnut1071
Posts: 313
Joined: Tue Aug 03, 2021 2:41 pm
Full name: Bill Beame

Re: Issue with Net 5.0

Post by Chessnut1071 »

spirch wrote: Tue Dec 14, 2021 1:30 pm stop using 5.0

start using 6.0
It appears Net 6.0 is approximately 18% faster on than Net 5.0 on most of my pseudo move generating code, was not expecting that big of an increase.