View Issue Details

IDProjectCategoryView StatusLast Update
0030654CommunityOCCT:Visualizationpublic2019-10-02 17:53
ReporterVico Liang Assigned Tobugmaster  
PrioritynormalSeverityblock 
Status closedResolutionno change required 
PlatformQT + Visual Studio 2017 UWPOSWindows 10 
Product Version7.4.0 
Target Version7.4.0 
Summary0030654: Visualization - AIS_InteractiveContext::MoveTo() failed to detect objects when using VS2017
DescriptionThe test was done on Microsoft Window 10 UWP cases.
Build the latest code from OCCT master with VS2017 + QT5.12.2 + QTANGLE. Build my test project adopted from sample QtAndroid with several changes to make it build on UWP. Then run the application with VS2017, on simulator, device or local desktop, none works. MoveTo won't detect the objects under mouse in most cases, there are several case hit though. The attached image will demo the cases.
Steps To Reproduce
pload MODELING VISUALIZATION
box b 1 2 3
vclear
vinit View1
vdisplay -dispMode 1 b
vfit
if { [lindex [vmoveto 250 250] 0] != "1" } { puts "Error" }

TagsNo tags attached.
Test case number

Attached Files

  • detect-failed.png (9,403 bytes)
  • detect-ok.png (9,536 bytes)
  • OCCT-Build-config.jpg (188,400 bytes)
  • custom.bat (1,180 bytes)
  • OCCT-MFCSamples-Modeling.jpg (120,839 bytes)
  • vs2017_15.7.4_OK.png (130,904 bytes)
  • vs2017_15.9.11_KO.png (124,587 bytes)
  • vs2017-5.9.12.png (42,873 bytes)

Relationships

related to 0030130 closedbugmaster Open CASCADE Coding Rules - MSVC 2017 gives warnings about using of std::fpos::seekpos() within RWStl 

Activities

Vico Liang

2019-04-17 10:49

developer  

detect-failed.png (9,403 bytes)

Vico Liang

2019-04-17 10:49

developer  

detect-ok.png (9,536 bytes)

kgv

2019-04-17 10:52

developer   ~0083815

Could you please clarify if you really mean that AIS_InteractiveContext::MoveTo() doesn't detect entities (e.g. AIS_InteractiveContext::DetectedOwner() is NULL), or that you don't see dynamic highlighting in 3D Viewer?

Vico Liang

2019-04-17 10:57

developer   ~0083818

I checked the result value from MoveTo, the value result is AIS_SOD_Nothing if there is no object detected, the values is AIS_SOD_OnlyOneDetected if there is object detected. So i'm sure it's not a highlighting issue.

kgv

2019-04-17 11:41

developer   ~0083819

Thats weird - there is no platform-dependent code in selection routines (the only thing are window dimensions using in math), so this should be some compiler issue...

Vico Liang

2019-04-17 17:10

developer   ~0083829

Microsoft Visual Studio Enterprise 2017
Version 15.9.11
VisualStudio.15.Release/15.9.11+28307.586
Microsoft .NET Framework
Version 4.7.03190

Installed Version: Enterprise

Visual C++ 2017 00369-90000-00000-AA005
Microsoft Visual C++ 2017

Application Insights Tools for Visual Studio Package 8.14.20131.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017 15.9.04012.0
ASP.NET and Web Tools 2017

C# Tools 2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

JavaScript Language Service 2.0
JavaScript Language Service

JavaScript Project System 2.0
JavaScript Project System

JavaScript UWP Project System 2.0
JavaScript UWP Project System

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package

MLGen Package Extension 1.0
MLGen Package Visual Studio Extension Detailed Info

NuGet Package Manager 4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info

TypeScript Tools 15.9.20918.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for CMake 1.0
Visual Studio Tools for CMake

Visual Studio Tools for Universal Windows Apps 15.0.28307.556
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Vico Liang

2019-04-17 18:22

developer   ~0083832

I guess the problem related to AIS_InteractiveContext::Activate routine, not all sub-shapes of object are activated in some cases, since the detecting algorithm is accurate from the detecting result.

Vico Liang

2019-04-18 12:51

developer   ~0083845

Dear KGV, The issue is reproduced on MFC samples too. I build the MFC samples with Visual Studio 2017, MoveTo can't detect the geometry objects under mouse in some cases. Could you please have a look at this on MFC samples?

kgv

2019-04-18 22:25

developer   ~0083859

> MoveTo can't detect the geometry objects under mouse in some cases.
Could you please provide complete steps to reproduce for MFC with necessary modifications (if necessary), opened model, activated selection mode(s) and mouse position?

By the way:
> Build my test project adopted from sample QtAndroid with
> several changes to make it build on UWP.
I don't see such attachments to this bug, maybe you have registered another issue for this sample improvement that I have missed?

Vico Liang

2019-04-19 04:16

developer  

OCCT-Build-config.jpg (188,400 bytes)

Vico Liang

2019-04-19 04:17

developer  

custom.bat (1,180 bytes)

Vico Liang

2019-04-19 04:19

developer  

OCCT-MFCSamples-Modeling.jpg (120,839 bytes)

Vico Liang

2019-04-19 04:26

developer   ~0083860

Last edited: 2019-04-19 04:37

Two images OCCT-Build-config.jpg and custom.bat are enclosed to show the OCCT build configuration. And then build the MFC samples without any modification. I test the sample Modeling. I try to move mouse on screen to touch geometry object, the issue is reproduced.

>>I don't see such attachments to this bug, maybe you have registered another issue for this sample improvement that I have missed?
No attachments uploaded about my test project adapted from QtAndroid. Since this issue is reproduced in MFC samples, it's should be much easier for developer to fix bug with MFC samples rather than building codes from UWP.

kgv

2019-04-26 11:17

developer   ~0084007

> I test the sample Modeling.
> I try to move mouse on screen to touch geometry object, the issue is reproduced.
Do you see the same issue with the same sample (Modeling) within last official release 7.3.0 (without re-building it)?

Vico Liang

2019-04-30 11:56

developer   ~0084068

Last edited: 2019-04-30 11:59

I installed the last official release 7.3.0 (without re-building it), it works well with the same sample (Modeling).

kgv

2019-05-14 08:50

developer   ~0084320

This is a REGRESSION coming with some VS2017 compiler update.

Tried:
- VS2017 15.7.4.
  Works as expected.
- VS2017 15.9.11.
  Debug build - works as expected.
  Release build - KO.

So, it looks like a compiler optimizer bug, which should be reported to compiler developers (Microsoft) - it is very difficult to do something with compiler bugs at application level.

You can also try downgrading VS2017 or use vc140 compiler toolchain (VS2015) also coming with VS2017 (should be explicitly enabled within VS2017 installer), although I'm not sure if it is trivial to configure.

kgv

2019-05-14 08:58

developer  

vs2017_15.7.4_OK.png (130,904 bytes)

kgv

2019-05-14 08:58

developer  

vs2017_15.9.11_KO.png (124,587 bytes)

Vico Liang

2019-05-14 12:00

developer   ~0084331

Even though it's just reproduced in release build, it still can't be determined a bug of compiler. There might be some issue in code, it's better to debug the issue or dump some log to see what happed.

kgv

2019-05-14 14:43

developer   ~0084338

Last edited: 2019-05-14 14:46

> it still can't be determined a bug of compiler
Nope, it is certainly a compiler bug.
Try adding the following dummy line into method BVH_BinnedBuilder::buildNode() within BVH_BinnedBuilder.hxx:
    for (Standard_Integer aSplit = 1; aSplit < Bins; ++aSplit)
    {
      // Simple SAH evaluation
      Standard_Real aCost =
        (static_cast<Standard_Real> (aSplitPlanes[aSplit].LftVoxel.Box.Area()) /* / S(N) */) * aSplitPlanes[aSplit].LftVoxel.Count
      + (static_cast<Standard_Real> (aSplitPlanes[aSplit].RghVoxel.Box.Area()) /* / S(N) */) * aSplitPlanes[aSplit].RghVoxel.Count;

      if (aCost <= aMinSplitCost)
      {
        aMinSplitCost   = aCost;
        aMinSplitAxis   = anAxis;
        aMinSplitIndex  = aSplit;
        aMinSplitBoxLft = aSplitPlanes[aSplit].LftVoxel.Box;
        aMinSplitBoxRgh = aSplitPlanes[aSplit].RghVoxel.Box;
        aMinSplitNumLft = aSplitPlanes[aSplit].LftVoxel.Count;
        aMinSplitNumRgh = aSplitPlanes[aSplit].RghVoxel.Count;
        if (!aMinSplitBoxLft.IsValid() && aMinSplitNumLft != 0) /// never actually happen
        {
          //std::cerr << "Was?\n"; ///
          throw Standard_ProgramError ("Was?"); ///
        }
      }
    }

Somehow aMinSplitBoxLft or aMinSplitBoxRgh become uninitialized BVH_Box, that should never happen (the added condition validates this).

I suppose this is somehow related to loop unrolling.
For instance, if replace "Bins" (which is a template parameter) in the loop with
> static const int aNbBins = Bins;
the bug will also go away.
This is incorrect, of course, because Bins template parameter might be different, but within particular test case it remains the same.

The bug cannot be also temporarily suppressed locally by "#pragma optimize()", because it happen in template and "#pragma optimize" has its own bug:
https://developercommunity.visualstudio.com/content/problem/104899/no-way-to-control-optimization-of-a-template-funct.html

kgv

2019-05-14 14:44

developer   ~0084339

I don't have much experience reporting compiler bugs, so maybe you can try reporting the issue to Microsoft engineers?

Vico Liang

2019-05-15 05:22

developer   ~0084346

Why not report your analyzing above to Microsoft, it's sufficient to approve a bug of compiler. You're a genius who can identify a bug of compiler.

git

2019-05-15 08:29

administrator   ~0084347

Branch CR30654_debug has been created by kgv.

SHA-1: 97a4e068de4dda5946f9c7c416d4e0550ab548cf


Detailed log of new commits:

Author: kgv
Date: Wed May 15 08:21:57 2019 +0300

    0030654: Visualization - AIS_InteractiveContext::MoveTo failed to detect objects under mouse on UWP

Vico Liang

2019-05-15 13:24

developer   ~0084366

It works with VS2017 Community 15.9.12.

Microsoft Visual Studio Community 2017
Version 15.9.12
VisualStudio.15.Release/15.9.12+28307.665
Microsoft .NET Framework
Version 4.7.03190
Installed Version: Community

Vico Liang

2019-05-15 13:27

developer  

vs2017-5.9.12.png (42,873 bytes)

kgv

2019-05-15 14:15

developer   ~0084367

> May   14, 2019 -- Visual Studio 2017 version 15.9.12
> April 02, 2019 -- Visual Studio 2017 version 15.9.11

kgv

2019-05-15 14:19

developer   ~0084368

Last edited: 2019-05-15 14:20

Dear bugmaster,

> ** Visual Studio 2017 Developer Command Prompt v15.9.6
Could you please perform regression testing on last Visual Studio 2017 update (on dedicated workstation),
and if there no issues update Jenkins workstations used for testing accordingly?

bugmaster

2019-06-17 11:09

administrator   ~0085086

I updated Visual Studio 2017 till last 15.9.13
There no regression and additional warnings.
2 improvement on unfolding. I removed TO DO.
Can issue can be closed?

kgv

2019-06-17 11:10

developer   ~0085087

Please close the issue.

git

2019-10-02 17:53

administrator   ~0087707

Branch CR30654_debug has been deleted by kgv.

SHA-1: 97a4e068de4dda5946f9c7c416d4e0550ab548cf

Issue History

Date Modified Username Field Change
2019-04-17 10:49 Vico Liang New Issue
2019-04-17 10:49 Vico Liang Assigned To => kgv
2019-04-17 10:49 Vico Liang File Added: detect-failed.png
2019-04-17 10:49 Vico Liang File Added: detect-ok.png
2019-04-17 10:52 kgv Note Added: 0083815
2019-04-17 10:57 Vico Liang Note Added: 0083818
2019-04-17 11:41 kgv Note Added: 0083819
2019-04-17 17:10 Vico Liang Note Added: 0083829
2019-04-17 18:22 Vico Liang Note Added: 0083832
2019-04-18 12:51 Vico Liang Note Added: 0083845
2019-04-18 22:25 kgv Note Added: 0083859
2019-04-19 04:16 Vico Liang File Added: OCCT-Build-config.jpg
2019-04-19 04:17 Vico Liang File Added: custom.bat
2019-04-19 04:19 Vico Liang File Added: OCCT-MFCSamples-Modeling.jpg
2019-04-19 04:26 Vico Liang Note Added: 0083860
2019-04-19 04:36 Vico Liang Note Edited: 0083860
2019-04-19 04:37 Vico Liang Note Edited: 0083860
2019-04-26 11:17 kgv Note Added: 0084007
2019-04-26 11:17 kgv Assigned To kgv => Vico Liang
2019-04-26 11:17 kgv Status new => feedback
2019-04-30 11:56 Vico Liang Note Added: 0084068
2019-04-30 11:56 Vico Liang Assigned To Vico Liang => kgv
2019-04-30 11:56 Vico Liang Status feedback => assigned
2019-04-30 11:59 Vico Liang Note Edited: 0084068
2019-04-30 12:14 kgv Relationship added related to 0030130
2019-05-14 08:50 kgv Note Added: 0084320
2019-05-14 08:55 kgv Steps to Reproduce Updated
2019-05-14 08:58 kgv Steps to Reproduce Updated
2019-05-14 08:58 kgv File Added: vs2017_15.7.4_OK.png
2019-05-14 08:58 kgv File Added: vs2017_15.9.11_KO.png
2019-05-14 12:00 Vico Liang Note Added: 0084331
2019-05-14 14:43 kgv Note Added: 0084338
2019-05-14 14:44 kgv Note Added: 0084339
2019-05-14 14:44 kgv Assigned To kgv => Vico Liang
2019-05-14 14:44 kgv Status assigned => feedback
2019-05-14 14:46 kgv Note Edited: 0084338
2019-05-15 05:22 Vico Liang Note Added: 0084346
2019-05-15 05:22 Vico Liang Assigned To Vico Liang => kgv
2019-05-15 08:29 git Note Added: 0084347
2019-05-15 13:24 Vico Liang Note Added: 0084366
2019-05-15 13:27 Vico Liang File Added: vs2017-5.9.12.png
2019-05-15 14:15 kgv Note Added: 0084367
2019-05-15 14:19 kgv Note Added: 0084368
2019-05-15 14:19 kgv Assigned To kgv => bugmaster
2019-05-15 14:20 kgv Note Edited: 0084368
2019-05-16 20:28 kgv Summary Visualization - AIS_InteractiveContext::MoveTo failed to detect objects under mouse on UWP => Visualization - AIS_InteractiveContext::MoveTo() failed to detect objects when using VS2017
2019-06-04 18:26 bugmaster Relationship added child of 0030715
2019-06-04 18:26 bugmaster Relationship deleted child of 0030715
2019-06-04 18:26 bugmaster Relationship added child of 0030715
2019-06-04 18:28 bugmaster Relationship deleted child of 0030715
2019-06-17 11:09 bugmaster Note Added: 0085086
2019-06-17 11:09 bugmaster Assigned To bugmaster => Vico Liang
2019-06-17 11:10 bugmaster Assigned To Vico Liang => kgv
2019-06-17 11:10 kgv Note Added: 0085087
2019-06-17 11:10 kgv Assigned To kgv => bugmaster
2019-06-17 11:38 bugmaster Status feedback => closed
2019-06-17 11:38 bugmaster Resolution open => no change required
2019-10-02 17:53 git Note Added: 0087707