MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0030654Community[OCCT] OCCT:Visualizationpublic2019-04-17 10:492019-06-17 11:38
ReporterVico Liang 
Assigned Tobugmaster 
PrioritynormalSeverityblock 
StatusclosedResolutionno change required 
PlatformQT + Visual Studio 2017 UWPOSWindows 10OS Version10
Product Version[OCCT] 7.4.0* 
Target Version[OCCT] 7.4.0*Fixed in Version 
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 Filespng file icon detect-failed.png (9,403 bytes) 2019-04-17 10:49
png file icon detect-ok.png (9,536 bytes) 2019-04-17 10:49
jpg file icon OCCT-Build-config.jpg (188,400 bytes) 2019-04-19 04:16
? file icon custom.bat (1,180 bytes) 2019-04-19 04:17
jpg file icon OCCT-MFCSamples-Modeling.jpg (120,839 bytes) 2019-04-19 04:19
png file icon vs2017_15.7.4_OK.png (130,904 bytes) 2019-05-14 08:58
png file icon vs2017_15.9.11_KO.png (124,587 bytes) 2019-05-14 08:58
png file icon vs2017-5.9.12.png (42,873 bytes) 2019-05-15 13:27

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

-  Notes
(0083815)
kgv (developer)
2019-04-17 10:52

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?
(0083818)
Vico Liang (developer)
2019-04-17 10:57

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.
(0083819)
kgv (developer)
2019-04-17 11:41

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...
(0083829)
Vico Liang (developer)
2019-04-17 17:10

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.
(0083832)
Vico Liang (developer)
2019-04-17 18:22

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.
(0083845)
Vico Liang (developer)
2019-04-18 12:51

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?
(0083859)
kgv (developer)
2019-04-18 22:25

> 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?
(0083860)
Vico Liang (developer)
2019-04-19 04:26
edited on: 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.

(0084007)
kgv (developer)
2019-04-26 11:17

> 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)?
(0084068)
Vico Liang (developer)
2019-04-30 11:56
edited on: 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).

(0084320)
kgv (developer)
2019-05-14 08:50

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.
(0084331)
Vico Liang (developer)
2019-05-14 12:00

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.
(0084338)
kgv (developer)
2019-05-14 14:43
edited on: 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 [^]

(0084339)
kgv (developer)
2019-05-14 14:44

I don't have much experience reporting compiler bugs, so maybe you can try reporting the issue to Microsoft engineers?
(0084346)
Vico Liang (developer)
2019-05-15 05:22

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.
(0084347)
git (administrator)
2019-05-15 08:29

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
(0084366)
Vico Liang (developer)
2019-05-15 13:24

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
(0084367)
kgv (developer)
2019-05-15 14:15

> May   14, 2019 -- Visual Studio 2017 version 15.9.12
> April 02, 2019 -- Visual Studio 2017 version 15.9.11
(0084368)
kgv (developer)
2019-05-15 14:19
edited on: 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?

(0085086)
bugmaster (administrator)
2019-06-17 11:09

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?
(0085087)
kgv (developer)
2019-06-17 11:10

Please close the issue.

- 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 View Revisions
2019-04-19 04:37 Vico Liang Note Edited: 0083860 View Revisions
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 View Revisions
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 View Revisions
2019-05-14 08:58 kgv Steps to Reproduce Updated View Revisions
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 View Revisions
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 View Revisions
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


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker