ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Real-time chart example
Posted by Philip on Oct-06-2020 04:25
Hi Peter,

I downloaded your ChartDirector for .NET for evaluation.

I'm reviewing the code for RealTimeZoomScrollWindow.xaml.

I'm getting an error: The name "WPFChartViewer" does not exist in the namespace "clr-namespace:ChartDirector;assembly=netchartdir"

I'm using Visual studio 2017 and it does not like the tag <ChartDirector:WPFChartViewer>

I was hoping to modify the form to add "right click" support.

Philip

  Re: Real-time chart example
Posted by Peter Kwan on Oct-06-2020 08:25
Hi Philip,

Since you are using WPF in VS 2017, I assume you are using the "NetWPFCharts.sln" sample Visual Studio solution, which is for the .NET Framework.

(There is another WPF solution "NetCoreWPFCharts.sln" which is for the ".NET Core" framework. Desktop applications in the ".NET Core" framework should use VS 2019.)

Have you tried to just compile and run the solution, and does it works normally? Does it work in the designer?

From our experience, occasionally, Visual Studio editor will mention that "WPFChartViewer does not exist in the namespace" message. However, the project compiles and works normally. Sometimes simply shutting down the project and re-open it will solve the problem.

I suspect this is a bug in Visual Studio "Intellisense" feature of the code editor.

In the past, we have seen this issue ourselves, but we cannot reproduce it. Once Visual Studio decides that it is not an error, we cannot make it produce the error message again.

If everything works normally despite the "WPFChartViewer does not exist in the namespace" message, you can consider just to ignore the message.

To avoid uncertainty, please make sure you have "unblock" the downloaded zip file before extracting its content out.

https://www.advsofteng.com/unblock_zip.html

You may also try to delete the hidden folder ".vs" created by Visual Studio before opening the project. The ".vs" folder is in the directory that contains the Visual Studio solution. It is created when Visual Studio first open the project, and it stores all classes/method/properties of all DLLs that Visual Studio can find in the project. The code editor can then use the database to check for code errors and to provide suggestions as you enter the code. If this database is corrupted, the code editor can produce incorrect error message. This will not affect the compiler and the designer, so everything will still work normally. If this folder is deleted, Visual Studio will rebuild it as if the project is opened for the first time. (The rebuilding will take may be 15 seconds.)

Regards
Peter Kwan

  Re: Real-time chart example
Posted by Philip on Oct-06-2020 20:36
Here is a more detailed description of the error in Visual Studio 2017:

An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.

  Re: Real-time chart example
Posted by Philip on Oct-06-2020 21:01
I solved the problem!!!

In the file

%windir%Microsoft.NETFramework[version]configmachine.config

I added

<configuration>
    <runtime>
       <loadFromRemoteSources enabled="true"/>
   </runtime>
</configuration>

  Re: Real-time chart example
Posted by Peter Kwan on Oct-06-2020 22:25
Hi Philip,

Thanks for posting your solution. It is certainly helpful to other people.

I would like to understand more about this problem. Is your DLL on your local hard disk, or is it on a network drive, and have you unblocked the zip file before extracting, or unblock the DLL?

It now reminds me that Window may not trust any network drive, even drives on the local network. Also, Windows will not trust any files downloaded from the internet, and will mark these files with a flag to indicate that the files are downloaded. The "unblocking" step is to remove this flag.

My current understanding is that if the file is on the local hard disk, and is unblocked, Windows should not treat it as a "remote" file. It should be handled just like any local file. So I would like to confirm if the above is in fact the case, or if Windows can somehow determine the DLL is "remote" even it is on a local hard disk and is unblocked.

Regards
Peter Kwan

  Re: Real-time chart example
Posted by Philip on Oct-07-2020 01:24
Hi Peter,

I'm using Windows 10 and Visual Studion 2017.

The DLL is on my local C: drive and I unblocked the zip file before extracting.

Philip