Work BuildFromDifferences Null reference exception
briancollog
Posts: 3
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);
stream.CopyTo(fileStream);
}
}
}
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.
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);
stream.CopyTo(fileStream);
}
}
}
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.
Comments
Sorry that you're experiencing this problem. Which version of the SDK are you using? If you try it with the latest version of the SDK, does the problem still occur? Here's a download link if you need it - download link
Redgate Software
Thanks.
Redgate Software