-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RaiseEvent throws Invalid length parameter passed to the LEFT or SUBSTRING function
when input is serialized json string
#160
Comments
@jundayin can you provide the call stack trace for this error? I'd like to confirm where exactly the error is coming from. |
Yes, I will provide it later today |
I truncated the stack traces from our business code. Let me know if that is also needed. @cgillum |
Thanks @jundayin. I think I found the code responsible for this error: INSERT INTO Instances (
[TaskHub],
[InstanceID],
[ExecutionID],
[Name],
[Version],
[RuntimeStatus])
SELECT DISTINCT
@TaskHub,
E.[InstanceID],
NEWID(),
SUBSTRING(E.[InstanceID], 2, CHARINDEX('@', E.[InstanceID], 2) - 2),
'',
'Pending'
FROM @NewOrchestrationEvents E
WHERE NOT EXISTS (
SELECT 1
FROM Instances I
WHERE [TaskHub] = @TaskHub AND I.[InstanceID] = E.[InstanceID])
GROUP BY E.[InstanceID]
ORDER BY E.[InstanceID] ASC I think this error can occur when you try to raise an event to an orchestration instance that doesn't exist. Could that explain the problem you're running into? |
We use TaskCompletionSource to make the orchestration waits for the signal of external event In some case, we are sending input within the external event and that is when the exception is thrown |
@jundayin if you call |
I hardly believe it is about non-existing orchestration instance because we get the instance ID through Does the RaiseEvent even filter orchestration instance by RuntimeStatus? |
So you're saying that the orchestration raises an external event to itself from one of its activities? If you examine the SQL code above, that |
Let me try to create a minimal repo from my side. |
even if we raise an event for an orchestration that is not created yet, or was deleted, it would be helpful to get a more suggestive error |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. |
That’s fair. We can definitely improve the error message. |
In some of our business flow, we want to pass in an object through the external event. Since the interface only accept
string
, we serialize the input and deserialize it once it is picked up by the workflow.However, there is some chance that the SQL Provider throws SqlException of
Invalid length parameter passed to the LEFT or SUBSTRING function.
during raising the event. I tried removing the heading and trailing space from the serialized string but the problem may randomly occursWorkaround that I've been done:
DTF Sql Provider version:
1.0.0-rc
DTFx Version:
2.8.0
The text was updated successfully, but these errors were encountered: