OleDbDataAdapter.Fill doesn't work when checkpoints are enabled - ssis

We faced a weird issue this week related to "OleDbDataAdapter.Fill" method in a script task. We are storing a query result in an Object variable and this data is used inside a script task. When checkpoints are enabled, we are not able to read the object variable using OleDbDataAdapter. When checkpoint is disabled - the code works fine.
Any workarounds for this issue ?
Regards,
Kumar

One cannot read variables from a blob object, which is what you would use to fill the OleDbDataAdapter using a debugger. You can however try to look through the results of the datatable to which you assign the value once that is initiated in the loop.
You can check this link that gives a very good breakdown of how to loop through object - https://www.timmitchell.net/post/2015/04/20/using-the-ssis-object-variable-as-a-data-flow-source/
In the script code that is pasted, you can put the debugger across foreach loop and then iterate and see through the results. This can be done

Related

SolidJS: "computations created outside a `createRoot` or `render` will never be disposed" messages in the console log

When working on a SolidJS project you might start seeing the following warning message in your JS console:
computations created outside a `createRoot` or `render` will never be disposed
There are some information available on this in SolidJS' Github repository issues. But after reading them I was still not quite sure what this was all about and whether my code was really doing something wrong.
I managed to track down where it came from and find a fix for it based on the documentation. So I'm providing the explanation and the solution for those Googling this warning message.
In essence this is a warning about a possibility of a memory leak due to a reactive computation being created without the proper context which would dispose of it when no longer needed.
A proper context is created a couple of different ways. Here are the ones I know about:
By using the render function.
By using the createRoot function. Under the hood render uses this.
By using the createContext function.
The first is by far the most common way, because each app has at least one render function call to get the whole show started.
So what makes the code go "out of context"?
Probably the most common way is via async calls. The context creation with its dependency tree happens only when the synchronous portion of the code finishes running. This includes all the export default function in your modules and the main app function.
But code that runs at a later time because of a setTimeout or by being in an async function will be outside of this context and any reactive computations created will not be tracked and might stick around without being garbage collected.
An example
Let's say you have a data input screen and have a Save button on it that makes an API call to your server to save the data. And you want to provide a feedback to the user whether the operation succeeded or not, with a nice HTML formatted message.
[msg,setMsg] = createSignal(<></>)
async function saveForm(){
...
setMsg(<p>Saving your data.<i>Please stand by...</i></p>)
const result=await callApi('updateUser',formData)
if(result.ok){
setMsg(<p>Your changes were <b>successfully</b> saved!</p> )
} else {
setMsg(<p>There was a problem saving your data! <br>Error: </p><pre>{result.error}</pre> )
}
}
...
<div>
...
<button onClick={saveForm} >Save</button>
{msg()}
</div>
This will produce the above mentioned warning when the API call returns an error, but not the other times. Why?
The reason for this is that SolidJS considers the code inserts inside JSX to be reactive, ie: need to be watched and re-evaluated. So inserting the error message from the API call creates a reactive computation.
The solution
I found the solution at the very end of the SolidJS doc. It's a special JSX modifier: /*#once*/
It can be used at the beginning of a curly brace expression and it tells the SolidJS compiler to explicitly not to make this a reactive expression. In other words: it will evaluated once and only once when the DOM nodes are created from the JSX.
In the above example here's how to use it:
setMsg(<p>There was a problem saving your data! <br>Error: </p><pre>{/*#once*/ result.error}</pre> )
After this there will be no more warning messages :)
In my case, I had an input and when that input changed I re-created an SVG drawing. Because the SVG creation was an expensive operation, I added a debounce in the createEffect function which ran when the input changed. debounce is a technique to defer the processing until the input stops changing for at least X amount of time. It involved running the SVG generation code inside the setTimeout function, thus being outside of the main context. Using the /*#once*/ modifier everywhere where I inserted an expression in the generated JSX has fixed the problem.

CODED UI TESTS: is there a way to add a warning in html report?

In my Coded UI Test project, I need to check if few Labels or Messages are consistent with the context. But those checks are not critical if not consistent and I need to output them only as warnings.
Note that I'm using nested ordered tests to use only one global ordered test with vstest.console.exe and get in one shot the overall test coverage report.
Till now I was creating assertions to check those consistencies, but an assertion failure leads to Test failure, then to ordered test failure and then to playback stop.
I tried to change Playback.PlaybackSettings.ContinueOnError value before and after the assertion: this works as I expect as the assertion is well reported as a warning in the html report file. But whatever, it causes the ordered test to stop and then my global ordered test chaining to fail...
I tried to use TestContext.WriteLine too instead of creating assert, but it seems that this is not output in the html report.
So my question is:
is there any way to create an assertion only as a Warning that will be output in the html report file and that doesn't lead to a test failure?
Thanks a lot for any answer and help on this ;)
So I got my solution with developping my own Warning Engine to integrate Warnings in test report, 'cause I found no existing solution for that with the current Coded UI Test Assertion engine.
I'll try to take some time to post generic parts of the code structure with comments translated in english (we're french so default comments are french for now...), but here are the main step lines :
Create a template based on the UITestActionLog.html original file
report structure of Coded UI Test engine, with only the start
bloc and the javascript functions and CSS declarations in it.
Create an assertion class with a main function to manage insertion
of Warning html bloc in the html report first created from the template.
Then create custom assert functions to call the main function
whereever on runtime, and custom Stopwatch to inject elapsed time in
the report ('cause I could'nt found a way to get back the elapsed
time directly from the Coded UI Test engine).
That's it.
Just a proposition as a way to do it, maybe not the best one but it worked for me. I'll try to take time to put blocl codes to be clearer on it.

Breakpoint in SSIS script task which is inside a ForEach Loop

I have an SSIS package which has got a foreach loop. inside the foreach loop I have a script task. I have put breakpoint in that script task, which gets hit but the problem is, it only gets hit on the first iteration. so if F10 or F5 it does not break again on the second iteration.
how can i make it break each time on the same point on each iteration.
It seems to be a expected behaviour of SSIS, as stated in Books Online:
"If a Script task is part of a Foreach Loop or For Loop container, the debugger ignores breakpoints in the Script task after the first iteration of the loop."
http://technet.microsoft.com/en-us/library/ms137625.aspx
You can try to work around it with the following alternatives:
Interrupt execution and display a modal message by using the MessageBox.Show method in the System.Windows.Forms namespace. (Remove this code after you complete the debugging process.)
Raise events for informational messages, warnings, and errors. The FireInformation, FireWarning, and FireError methods display the event description in the Visual Studio Output window. However, the FireProgress method, the Console.Write method, and Console.WriteLine method do not display any information in the Output window. Messages from the FireProgress event appear on the Progress tab of SSIS Designer. For more information, see Raising Events in the Script Component.
Log events or user-defined messages to enabled logging providers. For more information, see Logging in the Script Component.
http://technet.microsoft.com/en-us/library/ms136033.aspx
I know this is old question, but I have an idea like to share
As it's been answered by Guilherme, I can add something might be useful, if your foreach is based on a SQL query, you can add a ROW_NNUMBER() to it and assign it to a variable, inside the script task you can compare the value of this variable and break the task on any row you want.
if (Dts.Variables["Your_Variable"].Value.ToString() == "4") {
Console.WriteLine("Break");
}
At least you can stop iterating any place in the loop, rather than the first iteration.

Alternative to global variables

Hi I am doing a simple script where I want to track what step I am up to and use the result from a button click handler.
1)I cannot pass the variable as it is an event
2)Cannot use global variables as they seem to be constants only once set
Is there any way to set and object or variable multiple times and access the current value from within a handler function?
Found several examples suggesting a hidden widget, as well as that being a poor solution I also struggled to retrieve the value once set. IE it had a .setValue but no .getValue
Help please this is not a difficult thing in any other language I have tried but new to GAS
Cheers
There are more options - one, as you mentioned is to use a hidden widget. Although there is no .getValue(), it can be accessed through e.parameter within the click handler.
Two, for small amounts of data, you can use ScriptProperties / UserProperties and CacheService
Third, you can use the script DB or a spreadsheet if you are dealing with large amounts of data.
Having said all this, it would be better if you can post some code of what you're trying to achieve. Many times, code speaks louder than words.
Private Cache is intended for this type of thing https://developers.google.com/apps-script/reference/cache/

Seam EntityQuery without Transactions?

I'm using the code found here for Ajax ordered/pagination support for a Seam EntityQuery. The code itself is working great, and I am able to sort my data with no problem by various parameters. The entity itself is not a SQL table, but rather a SQL view mapped to a JPA (Hibernate) Entity. That, too, seems to be working without issue, so long as I stick to SELECT statements and not try to perform an INSERT or UPDATE. My backend DB is PostgreSQL 8.4, and I haven't implemented any conditional TRIGGERs to allow for VIEW update support.
My problem has to do when I go from one page of results to another using the EntityQuery.next() or EntityQuery.previous() methods. It appears the entire page request is wrapped in a transaction, and when I click my next button it attempts to perform an UPDATE on my Entity object. I've overridden the next() method in my EntityQuery and that operation goes through successfully. But, immediately after it finishes and right before the view is rendered the attempted UPDATE occurs. Since my Entity object can't be updated on the backend DB (since it's a VIEW) I get an Exception thrown.
Is there any way to prevent a transaction from being opened when using this EntityQuery? I've tried annotating my Entity object with #ReadOnly. That didn't work. I've tried adding #Transactional(NEVER) to my EntityQuery. That didn't work. Any other ideas?
Try changing to session scope on your component. That way seam will load the object from memory instead of hitting the database.
#Scope(ScopeType.SESSION)