Work BuildFromDifferences Null reference exception

briancollogbriancollog Posts: 3
edited May 4, 2016 4:26AM in SQL Comparison SDK 11
I am trying to call the BuildFromDifferences on the following code, but it is failing, throwing a null reference exception:

public void GenerateScriptsToFolder(Differences differences, string file)
foreach (var diff in differences)
diff.Selected = (diff.Type != RedGate.Shared.ComparisonInterfaces.DifferenceType.Equal
&& diff.Type != RedGate.Shared.ComparisonInterfaces.DifferenceType.OnlyIn1
&& diff.DatabaseObjectType != ObjectType.Schema);

var work = new Work();
work.BuildFromDifferences(differences, Options.IncludeDependencies, true);
using (var stream = work.ExecutionBlock.GetStream())
using (var fileStream = File.Create(file))
stream.Seek(0, SeekOrigin.Begin);

I am calling this function sending the differences (I can see them correctly when I create a datatable with the information), however, on the BuildFromDifferences, it is throwing a null reference exception without any more details.

Any idea why? is something wrong on this?

Best Regards.


Sign In or Register to comment.