System.Exception変数にNull以外の値を設定したい

こんにちは。UiPath Studio EnterPrise版23.4.2ユーザの初心者です。

Main.xamlの変数パネルでSystem.Exception変数を定義していますが、F5キーを押してWFをデバッグする際に、一時停止時にこの変数にNull以外の値を設定したいのですが、どのような値を設定すればよいでしょうか?
10などのInt32の値を入れても良いのでしょうか?

たとえば

New System.Exception("message")

のように設定すると良いかと思います。

Hi @gorby

No, you cannot set an Int32 value to a System.Exception variable. A System.Exception variable is a reference type, which means that it is a pointer to a location in memory where the actual object data is stored. Int32 is a value type, which means that it is a simple value that is stored directly in memory.

To set a System.Exception variable to a non-null value, you need to create a new System.Exception object and assign it to the variable. For example:

System.Exception myException = new System.Exception("This is an exception");

Once you have created a new System.Exception object, you can assign it to the variable in the Variables panel.

Here is an example of how you would do this:

  1. Open the Variables panel.
  2. Click on the System.Exception variable.
  3. In the Value field, type the following:

new System.Exception("This is an exception")

  1. Press F5 to start debugging your workflow.

When you press F5, your workflow will be paused at the first breakpoint. At this point, the System.Exception variable will be set to the new System.Exception object that you created.

Hope it helps!!