Data Issues
This guide covers common problems with data operations (pull/push) and their solutions.
Data Loss After Push
Symptoms:
- Fields reset to zero or empty after push
- Data that wasn't modified is gone
- Load combinations disappeared
Cause: Creating BeamDesign Directly
The most common cause is creating a BeamDesign object directly instead of pulling first.
Wrong approach:
// DON'T do this!
var design = new BeamDesign(); // All fields have default values (0, empty, null)
design.DesignCriteria.ProjectInformation.DesignerName = "Jane";
await client.PushBeamDesignerAsync("project", design);
// Result: ALL fields overwritten with defaults!
Correct approach:
// DO this instead
var design = await client.PullBeamDesignerAsync("project"); // Gets current values
design.DesignCriteria.ProjectInformation.DesignerName = "Jane";
await client.PushBeamDesignerAsync("project", design);
// Result: Only DesignerName changes, everything else preserved
Why This Happens
When you push a BeamDesign, every field is sent to Eriksson Beam:
- Fields you set explicitly
- Fields you didn't touch (still have their current values)
If you create a BeamDesign directly, unset fields have default values (0, null, empty), which then overwrite the actual data.
Push Validation Failed
Error: ServerErrorException with ResponseCode.InvalidRequest
Symptoms:
- Push operation rejected
- "Validation failed" error message
Causes and Solutions
1. Invalid Property Values
Some properties have constraints (minimum, maximum, required).
Solution: Check the error message for specific field:
catch (ServerErrorException ex)
{
Console.WriteLine($"Validation error: {ex.Response.ErrorMessage}");
// Message often indicates which field failed
}
2. Incompatible Data Combinations
Some property combinations may be invalid.
Example: Setting a section type that requires specific supporting data.
Solution: Ensure all required related properties are set.
3. Unsupported Section Type
Polygonal sections are not supported by the API.
Solution: Check if you're trying to modify a polygonal section:
if (design.ConcreteExtents?.GetType().Name == "Polygonal")
{
Console.WriteLine("Polygonal sections are not supported by the API");
return;
}
Project Not Found
Error: ServerErrorException - "Project not found"
Symptoms:
- Pull or push fails with project identifier
Causes and Solutions
1. Wrong Project Identifier
Solution: Get list of open projects and use exact identifier:
var openProjects = await client.GetOpenBeamProjects();
Console.WriteLine($"Open projects: {string.Join(", ", openProjects)}");
// Use one of the returned identifiers
var design = await client.PullBeamDesignerAsync(openProjects[0]);
2. File Not Open
Solution: Ensure the file is open in Eriksson Beam:
var openProjects = await client.GetOpenBeamProjects();
if (!openProjects.Contains("MyProject"))
{
Console.WriteLine("MyProject is not open in Eriksson Beam");
}
3. Multiple Files Open Without Specifier
If multiple files are open and you pass empty string:
Solution: Specify which project:
// With multiple files, must specify
var design = await client.PullBeamDesignerAsync("Project1");
// Empty string only works with single file
var design = await client.PullBeamDesignerAsync(""); // Fails if multiple open
Unexpected Data Values
Symptoms:
- Pulled values don't match what's shown in UI
- Values seem wrong or unexpected
Causes and Solutions
1. Unit Mismatch
The API uses inches and pounds. Eriksson Beam UI may display different units.
Solution: Convert units as needed:
// API returns inches
double lengthInches = tBeam.Length;
double lengthFeet = lengthInches / 12.0;
2. Timing Issue
Pull happens at a specific moment. If UI was recently changed:
Solution: Ensure Eriksson Beam has finished processing before pull.
3. Cached Data
Rarely, data may be cached.
Solution: Pull fresh data:
// Force fresh pull
var design = await client.PullBeamDesignerAsync("project");
Section Type Cast Errors
Error: InvalidCastException
Symptoms:
- Error when casting ConcreteExtents to specific type
- "Cannot cast object" errors
Cause: Wrong Section Type Assumption
// This throws if section is not TBeam
var tBeam = (TBeam)design.ConcreteExtents; // InvalidCastException!
Solution: Use Pattern Matching
// Safe approach with pattern matching
if (design.ConcreteExtents is TBeam tBeam)
{
// Work with tBeam
}
else
{
Console.WriteLine($"Section is {design.ConcreteExtents?.GetType().Name}, not TBeam");
}
// Or use switch expression
switch (design.ConcreteExtents)
{
case TBeam t:
break;
case IBeam i:
break;
case null:
Console.WriteLine("No section defined");
break;
default:
Console.WriteLine($"Unexpected section type: {design.ConcreteExtents.GetType().Name}");
break;
}
Null Reference Errors
Error: NullReferenceException
Symptoms:
- Error accessing nested properties
- "Object reference not set" errors
Cause: Nullable Properties
Some properties may be null:
// This can fail if ConcreteExtents is null
double length = design.ConcreteExtents.Length; // NullReferenceException!
Solution: Null Checks
// Safe access
if (design.ConcreteExtents != null)
{
// Safe to access properties
}
// Or use null-conditional operator
double? length = (design.ConcreteExtents as TBeam)?.Length;
// Or null-coalescing
var strandGroups = design.Reinforcement.Prestress.StrandGroups ?? new List<StrandGroup>();
Save Operation Fails
Error: ServerErrorException on SaveProject
Symptoms:
- File not saved
- Path-related errors
Causes and Solutions
1. Invalid Path
Solution: Use absolute path with extension:
// Correct
await client.SaveProject("project", @"C:\Projects\beam.ebf", true);
// Wrong - relative path
await client.SaveProject("project", "beam.ebf", true);
// Wrong - missing extension
await client.SaveProject("project", @"C:\Projects\beam", true);
2. Directory Doesn't Exist
Solution: Ensure directory exists:
var directory = @"C:\Projects\Output";
Directory.CreateDirectory(directory);
var path = Path.Combine(directory, "beam.ebf");
await client.SaveProject("project", path, true);
3. File Locked
Solution: Close other programs using the file.
Diagnostic Code
Use this to diagnose data issues:
public async Task DiagnoseDataState(ErikssonBeamClient client, string project)
{
Console.WriteLine($"=== Diagnosing: {project} ===\n");
try
{
var design = await client.PullBeamDesignerAsync(project);
// Project Info
Console.WriteLine("Project Information:");
Console.WriteLine($" Name: {design.DesignCriteria.ProjectInformation.ProjectName ?? "null"}");
Console.WriteLine($" Designer: {design.DesignCriteria.ProjectInformation.DesignerName ?? "null"}");
// Section
Console.WriteLine($"\nSection:");
Console.WriteLine($" Type: {design.ConcreteExtents?.GetType().Name ?? "null"}");
// Materials
Console.WriteLine($"\nMaterials:");
Console.WriteLine($" f'c: {design.DesignCriteria.MaterialProperties?.Concrete?.fc ?? 0} psi");
// Loading
Console.WriteLine($"\nLoading:");
Console.WriteLine($" Point Loads: {design.StructuralModel.Loading.PointLoads?.Count ?? 0}");
Console.WriteLine($" Distributed: {design.StructuralModel.Loading.DistributedLoads?.Count ?? 0}");
// Reinforcement
Console.WriteLine($"\nReinforcement:");
var strands = design.Reinforcement.Prestress.StrandGroups?.Sum(g => g.NumberOfStrands) ?? 0;
Console.WriteLine($" Total Strands: {strands}");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.GetType().Name}");
Console.WriteLine($"Message: {ex.Message}");
}
}
See Also
- Connection Issues - Connection problems
- FAQ - Common questions
- Best Practices - Recommended patterns