AN-IND-1-011 Using CANoe NET API
AN-IND-1-011 Using CANoe NET API
NET API
Version 2.4
2013-03-26
Application Note AN-IND-1-011
Table of Contents
2
Application Note AN-IND-1-011
Using CANoe .NET API
Version 2.3
• Project templates for .NET test libraries that are independent from CANoe’s configurations
Version 2.2
• Document structure revised
• Glossary added
• Quick start instructions (chapter 4.0)
• .NET test libraries for XML and .NET test modules (chapter 5.3.4)
• Overview of reporting elements (chapter 6.2.2)
• Diagnostic tests (chapter 6.2.8)
2.0 Glossary
CANoe .NET API
A set of assemblies (.dlls) providing access to CANoe’s functionality.
CAPL Library
A collection of CAPL test cases and test functions that can be used from your .NET program.
PostSharp
After VisualStudio compilation PostSharp compiles the assembly for a second time and enriches e.g. methods marked with the
test case attribute with additional code. The additional code controls execution of the test case.
Snippet
A small piece of .NET program code that can be executed like a macro. Snippets can be changed and recompiled while
measurement is running.
.NET Test Library
A .NET assembly containing further test cases, test functions or customer specific methods. A .NET Test Library is added as a
component to a .NET or XML test module.
Runtime Values
Objects that represent signals, system variables and environment variables.
Type Library
A library that is generated by CANoe. It contains configuration specific data type definitions to comfortably access frames,
signals, environment variables, system variables and CAPL library function from your .NET program.
3.0 Introduction
Effective with version 7.0 the CANoe environment was expanded to include a .NET API to be used for simulation, test, and
snippet programming. The CANoe .NET API is an Embedded Domain Specific Language extension that offers the possibility to
use object-oriented programming languages, e.g. C# in the CANoe environment. .NET languages provide extended capabilities
to structure, to reuse and to debug programs.
This document uses C# as recommended programming language. Nevertheless also Visual Basic .NET or J# could be used.
The .NET API can be used as an alternative to CAPL for test module or simulated node programming. It can also be used for
programming so-called snippets, mainly used for simple stimulation or initialization purposes.
Discussed in this document is the .NET API concept and its usage in CANoe. It is assumed that the reader is familiar with the
.NET framework and the application note ‘AN-IND-1-002 Testing with CANoe’.
3
Application Note AN-IND-1-011
Using CANoe .NET API
4
Application Note AN-IND-1-011
Using CANoe .NET API
[TestFunction("SetValue")]
public void SetValue(int a)
{
NetworkDB.database1.SigStart.Value = a;
}
}
4.1.4 Create a .NET Test Library that is independent from a CANoe configuration
This chapter describes how to create a test library that is independent from the CANoe’s configuration, i.e. it does not need
references to configuration dependent type libraries. As an advantage such a library can be used in any CANoe configuration
but some special handling is necessary when accessing configuration specific data, e.g. signals.
VisualStudio will offer a .NET test library template project when you copy
C:\...\CANwin Demos\Demo_Addon\VS_DotNetTestLibary_Template\CANoe DotNet Test Library.zip
to your Visual Studio CSharp Project Template folder, typically located here:
You can check the template folder in your VisualStudio Options dialog: “Projects and Solutions/General/User project templates
location”.
5
Application Note AN-IND-1-011
Using CANoe .NET API
At next a new .NET test library can be created in Visual Studio with ‘File/New/Project/Visual C# ‘and selecting 'CANoe DotNet
Test Library'. Before confirming the dialog with ‘OK’ you should select a library name and the folder.
After a first compilation the assembly can be added to the XML tester components.
5.0 Environment
• Type libraries:
They are dynamically generated by CANoe and ensure type-safe and convenient access to database signals,
messages etc. Type libraries are automatically updated when the underlying data is changed.
Database object will be represented by a class under the namespace NetworkDB. Environment variables are directly
accessible under this namespace while message objects are always created in a subordinate namespace called
Frames to prevent possible conflicts with signal classes. In case of name ambiguities of signals or messages, the
namespaces of the generated libraries (e.g. qualification of signals --> DB.Node.Message.Signal) can be adjusted in
the Options dialog in CANoe (menu Configuration | Options, Configuration Settings | .NET). After changes are made in
this dialog CANoe will regenerate the type libraries automatically. System variables are created under the user chosen
namespaces.
When editing a .NET program (IDE started with CANoe) and no solution is found in the configuration folder CANoe creates a
solution with all needed API references.
Note CANoe supports generation but not modification of the VS solution/project file. If more components are
added in the node configuration dialog or if a new database is added, these libraries must be added manually
as references to the VS project.
6
Application Note AN-IND-1-011
Using CANoe .NET API
• Vector.CANoe.TFS
Contains the interfaces of the Test Feature Set.
• Vector.CANoe.TFS.Internal
Internal CANoe interface used by Vector.CANoe.TFS.
• Vector.CANoe.Threading
Contains the interfaces for e.g. wait commands, wait conditions and user input dialogs.
• Vector.Diagnostics
Contains the interfaces of the Diagnostic Feature Set.
• Vector.Scripting.UI
Contains further user dialogs for test nodes and .NET snippets.
• PostSharp.Public and PostSharp.Laos
Are used for post-compilation and enable automatic reporting.
• <DB name>.dll
For all messages and signals and environment variables in the CAN database this assembly contains class definitions.
The assembly is automatically generated and updated by CANoe.
• <configuration name>.cfg_sysvars.dll
This assembly contains class definitions for all system variables used in the configuration. The assembly is
automatically generated by CANoe.
• <system variable file>.dll
For the system variables defined in configuration files.
• <program name>_CaplLibraries.dll
Contains the functions to access CAPL test cases and test functions from within .NET test modules
Note1: All .NET programs are executed in the runtime environment of CANoe and can slow down or even block the
simulation.
Note2: This document describes the .NET API available with CANoe version 7.5.
Note3: For older versions some restrictions apply, please refer to the online help for detailed information
The open source environment SharpDevelop could be used as an alternative to Visual Studio but there is no script to support
this IDE. The user must configure the environment manually, e.g. add all references etc.
To configure the .NET editor to be used in CANoe go to the Options dialog (menu Configuration | Options, External Programs |
.NET file editor) and select the relevant script (vbs file). The available scripts for Visual Studio are delivered with the CANoe
installation and located in the folder <CANoe installation path>\Exec32\Scripts.
Note: It is important to configure the vbs script, and not the exe file of the editor, in CANoe.
7
Application Note AN-IND-1-011
Using CANoe .NET API
configuration dialog in CANoe and pressing the [Edit] button. The generated solution is opened with the chosen IDE, including
all correct settings.
8
Application Note AN-IND-1-011
Using CANoe .NET API
The resulting test library assembly can be added to an XML or .NET test module via the component tab of the node
configuration dialog. The test library assembly must be located in the same folder as the test module.
When a test library itself references further assemblies these assemblies should be declared in the node configuration dialog.
This way CANoe will be able to transfer all components when the simulation process is executed on a remote computer.
Note All .NET Test Libraries under the Component tab in Test Module Configuration dialog will be added as
references to the VS project of the test module, as long as they were configured before the creation of the test
module project file.
It is important to differ between a .NET test module (Main() method is also implemented in .NET) and an XML test module
with a .NET test case library.
In a.NET test module all variables are valid during the whole test. But if test cases from a library are used in an XML test
module the test cases are independent from each other, i.e. each test case is instantiated once and variables are valid during
test execution.
It should be noted that test cases implemented in a library may be called in an arbitrary sequence and should be treated
according to this principle (initialization, usage, cleanup).
.NET test functions are called with a <nettestfunction> XML element inside XML test cases. It is possible to call several
different test functions within the same test case.
<testcase title="My Test case Title" ident="">
<nettestfunction name="MyTestFunction" title="Calling a NET test function"
class="LockStateDependsOnlyOnVelocity" assembly="TestLibrary">
<netparam type="int" name="myInt">10</netparam>
</nettestfunction>
</testcase>
Parameter types can be numerical values, strings, signals, environment and system variables.
XML type .NET type
int UInt64, UInt32, UInt16, Int64, Int32, Int16
float Double
string String
signal Vector.CANoe.Runtime.Signal
envvar Vector.CANoe.Runtime.EnvironmentVariable
sysvar Vector.CANoe.Runtime.SystemVariableBase
9
Application Note AN-IND-1-011
Using CANoe .NET API
In contrast to the value types (int, float, string), the signal types are declared as Generics in the test case. Constraints must be
applied to these Generics in order to guarantee type reliability. The specific types Signal, EnvironmentVariable or
SystemVariableBase can be used for this.
The following definition is required if you want to use a test case for all three signal types similarly:
[TestCase]
public void SetSignal<T>(Double d) where T : class, IRuntimeValue
{
RuntimeObject<T>.Value = d;
}
5.3.5 .NET Test Module and CAPL Test Cases / Test Functions
CAPL files can be assigned to a .NET test module with the test module configuration dialog. All CAPL test functions and test
cases can be called from the .NET test module.
Not all CANoe features are available in the .NET API (this especially concerns bus system specifics) but with CAPL test
libraries you can easily access the complete functionality.
CAPL libraries that are assigned to the .NET test module are structured like CAPL test modules, but they must not contain a
MainTest() routine. Event procedures are only called during runtime of the .NET test module. All event procedures of the
assigned CAPL libraries are considered except ‘on start’ and ‘on stop’.
CAPL test cases and test functions may use parameter types ‘char, char[], byte, int, long, float, double’. Results can be returned
via system or environment variables.
A CAPL test case or test function can be called like any other .NET method. If they are used in structured test module they have
to be wrapped by a .NET test case or a TestGroup method.
CaplTestCases.CaplTestLib.MyTestCase(“test”);
CaplTestFunctions.CaplTestLib.MyTestFunction(23.0);
Both have been defined in a CAPL library “CaplTestLib.can” and a reference for this library is configured in the .NET solution.
The CAPL library looks like this:
10
Application Note AN-IND-1-011
Using CANoe .NET API
In the signal-based view CAN, LIN and FlexRay bus signals are supported.
Note that setting the value usually doesn't change the value directly; in case of signals, the current value is only changed after a
message which contains the signal has been transmitted on the bus and received again.
Environment variables can be handled in the same way, e.g.
MyIntegerEv.Value = 1;
In case the environment variable is a data array type you can easily read each byte with the index operator:
if (MyDataEv.Value[2] == 2) {…}
6.1.2 Messages
In the message-based view CAN messages are supported in a first step. For the CAN frames that are defined in databases,
specific classes are generated in type libraries.
To construct a user-defined CAN message which is not defined in a database (e.g. dbc), the class CANFrame can be used as a
super class. Signals are defined with the [Signal] attribute. Their offset and the least significant bit of the signal are as a bit
number. Signal overlap etc will be checked at compile time.
CAN messages can also be declared by creating instances of the CANFrame class and initializing the ID and DLC in the
constructor. Message data can only be set in raw format, either byte-wise using the property Bytes[] or by a byte array which
must be of size 8 bytes min:
byte[] data = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 };
CANFrame msg = new CANFrame(0x500, 4); // ID=0x500, DLC=4
msg.SetRawData(data);
msg.Send();
To implement different send models CANoe is able to use so-called interaction layers realized by DLLs. OEMs often use
specific interaction layers but there is also a generic Vector Interaction Layer available. If an interaction layer is used in the
CANoe configuration, it is sufficient to set signal values without having to send messages explicitly – messages will be sent
according to the correct send model by CANoe (e.g. cyclic messages will be sent automatically according to the required cycle
time and sending mode).
Note that message objects in the configured databases are always created in a subordinate namespace called Frames to
prevent possible conflicts with signal classes. Access to e.g. message VehicleMotion is accomplished through
NetworkDB.Frames.VehicleMotion.
6.1.3 Timer
The attribute [OnTimer] can be used to accomplish a cyclic timer. The method will be executed cyclically at the defined time
point (here 1s).
For test modules the timer is active when the test module is active and for simulation nodes it is active during measurement.
[OnTimer(1000))]
public void OnTimer1s() {
Output.Writeline("Timer elapsed");
}
If a timer should be started and stopped at a certain point, timer objects can be used instead. Use the Timer class and its
properties/methods, e.g. define a timer handler:
{
Timer t = new Timer(new TimeSpan(0, 0, 0, 0, 250),TimerHandler);
t.Start();
…
t.Stop();
}
A handler that reacts on value changes of the network signal LockState is defined like this:
[OnChange(typeof(LockState))]
public void OnSignalLockState() {
double value = LockState.Value;
}
The .NET signal-oriented API only supports ‘on change’ handlers in contrast to CAPL that supports both ‘on change’ and ‘on
update’ handlers. One reason is the performance aspect in .NET programs. Another reason is that the signal based tests are
state-based.
In contrast to this message handlers (introduced with version 7.1) are event-based. To handle a message event for message
WindowState use the [OnCANFrame] attribute. The CAN channel and message ID can also be specified in the attribute
constructor.
[OnCANFrame]
public void onMessage(NetworkDB.Frames.WindowState frame) {
double pos = frame.WindowPosition.Value;
}
[OnCANFrame(1, 500)]
public void Frame500Received(CANFrame frame) {…}
Use the attribute [OnKey] to react on key events. The defined method must have one char parameter.
[OnKey('+'))]
public void OnKeyPressed(char ch) {
Output.WriteLine("+ was pressed");
}
To handle timer events the [OnTimer] attribute should be used. The method TimerElapsed below will be called every 500
ms:
[OnTimer(500))]
public void TimerElapsed() {
msg.Send();
}
Both module types are very similar and their format is described in the following chapters.
Unstructured test modules
An unstructured.NET test module must inherit from class Vector.CANoe.TFS.TestModule. It consists primarily of the Main
method where the test control flow and the test cases are executed. Test groups can be used to organize test cases that belong
together. Test cases are defined with the custom attribute [TestCase] and can be divided into test steps. The
Vector.CANoe.TFS.Report class is used for reporting to the report file.
The Main method of the test module is the main program of the test module analog to a CAPL test module. It is required to
override the inherited Main method of the TestModule class. The main method groups test cases and executes them
sequentially:
public class MyTestModule : TestModule
{
public override void Main()
{
TestGroupBegin("Id", "Title", "Description");
TestCase1();
if (TestModule.VerdictLastTestCase == Verdict.Passed)
{
TestCase2();
}
TestCase3();
TestGroupEnd();
}
}
[TestCase("Test case title")]
public void TestCase1()
{
Report.TestStep("Description of the test step");
}
The Main method should only contain test flow control. The concrete tests should be done in the test cases. Complex flow logic
can be implemented, e.g. letting a test case execute multiple times by calling it in a loop or prevent execution of a test case if a
preceding test case returned failure.
In general test cases should be programmed such that they don’t depend on each other, e.g. by not using global variables
between test cases. It is recommended to start every test case from anew; initialize parameters before test case start and – if
needed – reset parameters after test case end. This ensures good programming practice and possible code re-use (which is
one of the main motivations for the .NET API).
Event procedures are only active during test module run-time since test modules need not always be active during the whole
measurement time (see also AN-IND-1-002 Testing with CANoe).
Structured test modules
A structured.NET test module must inherit from class Vector.CANoe.TFS.StructuredTestModule. The
StructuredMain method of the test module is the main program and it is required to override the inherited
StructuredMain method of the StructuredTestModule class.
It is required that dynamic test sequences (test sequences that may vary between two test runs) are encapsulated with methods
that are marked with the [TestGroup] attribute. A dynamic test group will always be executed as a whole.
The example shows a DynamicTestGroup() and a normal test group with two test cases.
TestCase3();
TestGroupEnd(); }
}
[TestCase("Test case title")]
public void TestCase1()
{
Report.TestStep("Description of the test step");
}
…
[TestGroup(“Dynamic Test case sequence”,” depends on preceding test case results”)]
public void DynamicTestGroup()
{
TestCase1();
if (TestModule.VerdictLastTestCase == Verdict.Passed)
{
TestCase2();
// …
}
}
The StructuredMain method should define the test sequence only. The concrete tests should be done in the test cases and
test groups.
Event procedures are only active during test module execution (see also ‘AN-IND-1-002 Testing with CANoe’).
The special CANoe mode does not allow accessing runtime values and invoking methods from
Vector.CANoe.Runtime, Vector.Tools, Vector.Scripting.UI, Vector.CANoe.Threading
and most of the methods in Vector.CANoe.TFS. For this they cannot be called in the StructredMain()
method.
It is not allowed to call CAPL test cases or test functions in the StructuredMain() method.
The execution sequence of the test cases in the module must be constant, e.g. a random execution of test
cases is not allowed and may lead to unexpected enabling / disabling states of the test cases.
If you have a set of test cases that are randomly executed or that depend on the test verdicts from other test
cases you should encapsulate them in a method that is marked with a [TestGroup] attribute. The body of such
a method is also not executed during test module analysis and the group can only be enabled / disabled as a
whole. An example for this can be found in the Central Locking Demo .NET of CANoe.
Verdict handling:
• TestStepFail(…) The teststep verdict will be set to ‘Fail’ and it is propageted to the related test case and test module
verdict.
• TestStepPass(…) A passed test step with additional information is written to the report. The verdict is not changed.
15
Application Note AN-IND-1-011
Using CANoe .NET API
A complete list can be found in the CANoe help or in the type libraries that are referenced in your test module solution.
The signal-oriented API in .NET is state-oriented. This means that if a wait point for a signal element is used the wait condition
is checked immediately and if the signal is already set (i.e. the condition is met), the wait point also resumes immediately.
In contrast to the signal-oriented approach in .NET message-oriented approach is event-based.
6.2.4 Checks
Checks in .NET test modules are used to monitor certain system conditions during a test sequence. There are three types of
checks; Constraints, Conditions and additionally Observations.
Constraints are used to guarantee that the environment fulfills certain criteria and Conditions supervise the behavior of the
tested system. Any violation of these checks leads to a failing test case and test module.
This is in contrast to Observations that cannot influence the verdict of a test module even though violations are always included
in the test report.
Checks can be active during a complete test sequence, a complete test case, or they can be activated/deactivated using
method calls.
The TFS provides several predefined checks
• Vector.CANoe.TFS.ValueCheck is used to monitor the value criteria of bus signals, environment and system
variables
• Vector.CANoe.TFS.AbsoluteCycleTimeCheck, Vector.CANoe.TFS.RelativeCycleTimeCheck and
Vector.CANoe.TFS.OccurenceTimeCheck check the timing of messages
• Vector.CANoe.TFS.DlcCheck monitors the message length indication
The class ValueCheck represents a simple check for the value of a signal, environment variable or system variable. Here the
value of the signal EngineRunning is checked:
[TestCase("Title", "Description")]
public void ObserveEngineState()
{
ICheck engOn = new ValueCheck<EngineRunning>(CheckType.Observation, 1);
engOn.Activate();
16
Application Note AN-IND-1-011
Using CANoe .NET API
This is an example of checking the value of a bus signal. First the check for the signal value is created with the type Condition
for the value ‘1’. Then the check is activated, and after a 4s wait the check is deactivated before the test case end.
A cycle time check for a message is done like this. The activation is done as in the previous example.
ICheck check = new AbsoluteCycleTimeCheck<NetworkDB.Frames.CyclicMsg>
(CheckType.Condition, 80, 120);
If user-defined system conditions should be checked, a customized class can be defined (e.g. for DLC observation):
public class MyUserCheck : UserCheck
{
public MyUserCheck(string title, string description)
: base(title, description)
{}
[OnCANFrame(1, 0x64)]
public void FrameReceived1(CANFrame frame)
{
if (frame.DLC != 1)
ReportViolation("DLC check for frame 0x64 failed");
}
}
17
Application Note AN-IND-1-011
Using CANoe .NET API
6.2.5 Criterions
Criterions can be used
The Criterion attribute can be used to define a handler to be used within checks or wait points
[Criterion]
[OnChange(typeof(AntiTheftSystemActive))]
[OnChange(typeof(LockState))]
bool AntiTheftSystemCriterion()
{
if((EngineRunning.Value == 0) && (LockState.Value == 1))
return (AntiTheftSystemActive.Value == 1);
else
return (AntiTheftSystemActive.Value == 0);
}
Apply the criterion above in a Check – the check fails, if the criterion handler returns false:
Check observeAntiTheftSystem = new Check(AntiTheftSystemCriterion);
observeAntiTheftSystem.Activate();
Apply the criterion above in as Wait Point condition – the wait point is resumed, if the criterion handler returns true:
Execution.Wait(AntiTheftSystemCriterion);
Note1: The handler was immediately called on setup of the wait or the check to handle the start condition.
Note2: Handlers that are marked with the Criterion attribute are only active while the check or wait condition is active.
The Criterion class can be used to combine several single criterions to a complex criterion, e.g. when several signal values
have to be checked in parallel. This is similar to the testJoinAuxEvent() function in CAPL.
Criterion antiTheftSystem = new Criterion();
antiTheftSystem.AddMandatory(new ValueCriterion<AntiTheftSystemActive >(0));
antiTheftSystem.AddOneOf(new ValueCriterion<LockState>(0));
antiTheftSystem.AddOneOf(new ValueCriterion<EngineRunning>(1));
Again the combined criterion can be used I a check – the check is failed, if a mandatory condition is violated or if all optional
conditions are violated:
Check observeAntiTheftSystem = new Check(antiTheftSystem);
observeAntiTheftSystem.Activate();
And also as a wait condition – the wait point is resumed, if if all mandatory conditions are fulfilled and if one optional condition
is fulfilled:
Execution.Wait(antiTheftSystem, 1000);
18
Application Note AN-IND-1-011
Using CANoe .NET API
The created test pattern can now be used in a test case, e.g. by applying the Execute() method on it:
[TestCase]
public void LockStateDependsOnCrashDetection()
{
// Test Pattern - Crash Detection function test
CrashDetectionTest crashTest = new CrashDetectionTest();
crashTest.Execute();
// Change test pattern input parameter and re-execute
crashTest.crashDetected = 0;
crashTest.Execute();
}
19
Application Note AN-IND-1-011
Using CANoe .NET API
The service and parameter qualifier can be copied from the CANoe symbol explorer.
More background information can be found in ‘VDS_Library_QuickStartr.pdf’ that is available in the CANoes start menu / Help /
‘Documentation Vector Diagnostic Scripting Library’.
20
Application Note AN-IND-1-011
Using CANoe .NET API
7.0 Migrating a .NET Module that was created with CANoe < 7.6SP3
When a .NET module (network node, test node or test library) is created with CANoe < 7.6SP3 the solution contains absolute
path references to the CANoe .NET API.
When you change to CANoe 7.6SP3 or newer these references and assemblies have to be updated with the actual ones that
contain a link to the used CANoe installation:
• Remove the solution (*.sln) and the project (*.csproj) files for your module from your CANoe configuration folder. If the
solution or project has user defined settings they have to be redone.
• In CANoe start editing the .NET module. A new solution with all needed references is created for the module. As a
precondition you should configure the new CANoe version to use VisualStudio as editor, see also chapter 3.1.
8.2 Concurrency
There is only one real-time thread in CANoe which means that all simulated network nodes and test modules are run in that
same thread. Therefore synchronizing is of no concern. While a test module is waiting for an event (a so-called wait point),
other test modules, or CAPL code is run. As event procedures in simulation CAPL and test code (CAPL or .NET) are
conceptually designed to be atomic (see AN-IND-1-002 Testing with CANoe), long running operations should never be
programmed in CAPL or .NET code without intermediate wait points.
Note Use of the System.Threading.Thread class leads to undefined behavior and may cause invalid results or
program instability.
Due to the CANoe internal concurrency architecture, synchronization primitives (e.g. locks) and additional
threads are not permitted in a .NET program.
21
Application Note AN-IND-1-011
Using CANoe .NET API
When the .NET module has been built with CANoe there is normally no debugging information available and you should first
rebuild the assembly with enabled debug mode in the IDE or you can enable .Net Debugging in CANoe with CANoe-
>Configuration->Options->External Programs ->.NET Debugging.
In case you debug your module in CANoe’s simulation mode it is useful to enable ‘windows timer’ under CANoe->Configuration-
>Options->Configuration Settings->Simulation.
For detailed information on how the debugger should be attached, please refer to the Visual Studio documentation.
8.4 Post-compilation
PostSharp is an open-source tool that transparently inserts itself in the build process and post-processes the compiled
assembly. With PostSharp, application domain specifics can be encapsulated as custom attributes that will add new behaviors
to the code. This tool is used by CANoe for post-compilation (e.g. for the custom attribute [TestCase]).
The post compilation of the .NET assemblies is done by CANoe for all kinds of .NET modules. The post compilation of the .NET
assemblies is done by Visual Studio if PostSharp has been installed on the computer.
Assemblies which were compiled with an older version of CANoe, but without the post-compilation step, have to be rebuild with
the newer version of CANoe again before the post-compilation can be done again. It is only an issue if an assembly was directly
configured in CANoe that was not post-compiled.
Note: It is recommended to let CANoe create the solution or install PostSharp. So there is always a post-compilation
step on build of the .NET program.
8.5 Troubleshooting
22
Application Note AN-IND-1-011
Using CANoe .NET API
This warning can occur if the test case library was not post-compiled. A work-around can be to install PostSharp so that Visual
Studio post-compiles the library.
8.5.4 Visual Studio cannot build because annother process holds the .NET assembly
Sometimes the RuntimeKernel.exe holds the assemblies after the measurement has been ended.
This problem can occur if the .NET solution/source file was created manually (i.e. not automatically by CANoe). If the file was
created manually the problem can be fixed by adding the following in Pre-build event command-line in Visual Studio:
"C:\Program Files\<CANoe inst dir>\Exec32\Scripts\ReleaseDotNetAssemblies.vbs" "$(SolutionPath)"
A new solution with correct settings can be created by deleting the old solution and editing the node. CANoe creates a solution
with all needed API references and commands..
23
Application Note AN-IND-1-011
Using CANoe .NET API
10.0 Contacts
Vector GB Ltd. Vector Automotive Technology Vector Informatik India Pvt. Ltd.
Rhodium, Central Boulevard (Shanghai) Co., Ltd. 4/1/1/1, Sutar Icon, Sus Road,
Blythe Valley Park Sunyoung Center Pashan, Pune - 411 021
Solihull, Birmingham Room 1701, No.398 Jiangsu Road INDIA
West Midlands B90 8AS Changning District
UNITED KINGDOM Shanghai 200050
Phone: +44 121 50681-50 P.R. CHINA Phone: +91 20 2587 2023
Fax: +44 121 50681-69 Phone: +86 21 6432 53530 Fax: +91 20 2587 2025
Fax: +86 21 6432 5308
E-mail: info@uk.vector.com E-mail: info@cn.vector.com E-mail: info@in.vector.com
Vector CANtech, Inc. Vector Japan Co. Ltd. Vector Korea IT Inc.
39500 Orchard Hill Place, Suite 550 Tennozu Yusen Bldg. 16F 5F, Gomoas bldg., 12
Novi, MI 48375 2-2-20 Higashi-shinagawa, Hannam-daero 11-gil, Yongsan-gu
USA Shinagawa-ku, Seoul, 140-889
Tokyo 140-0002 REPUBLIC OF KOREA
JAPAN
Phone: +1 248 449 9290 Phone: +81 3 5769 7800 Phone: +82 2 807 0600
Fax: +1 248 449 9704 Fax: +81 3 5769 6975 Fax: +82 2 807 0601
E-mail: info@us.vector.com E-mail: info@jp.vector.com E-mail: info@kr.vector.com
24
Application Note AN-IND-1-011