F# project is taking so much time to build - visual-studio-2013

I have created f# solution and added one class library. Only one project in the solution and 5 files and 20 lines of code in each file. Still it will take more 2 minutes to build each time.
I have tried to clean solution.
Also created new solution and project and includes same files, still it will take same time to build it.
Note : First I have created it as a Console Application then convert it into the Class Library.
Edit: Code Sample `
open System
open Configuration
open DBUtil
open Definitions
module DBAccess =
let GetSeq (sql: string) =
let db = dbSchema.GetDataContext(connectionString)
db.DataContext.CommandTimeout <- 0
(db.DataContext.ExecuteQuery(sql,""))
let GetEmployeeByID (id: EMP_PersonalEmpID) =
GetSeq (String.Format("EXEC [EMP_GetEntityById] {0}",id.EmployeeID)) |> Seq.toList<EMP_PersonalOutput>
let GetEmployeeListByIDs (id : Emp_PersonalInput) =
GetSeq (String.Format("EXEC [EMP_GetEntityById] {0}",id.EmployeeID)) |> Seq.toList<EMP_PersonalOutput>`
configuration code snippets : `open Microsoft.FSharp.Data.TypeProviders
module Configuration =
let connectionString = System.Configuration.ConfigurationManager.ConnectionStrings.["EmpPersonal"].ConnectionString
//for database,then stored procedure, the getting the context,then taking the employee table
type dbSchema = SqlDataConnection<"", "EmpPersonal">
//let db = dbSchema.GetDataContext(connectionString)
type tbEmpPersonal = dbSchema.ServiceTypes.EMP_Personal`

Okay, seeing your actual code, I think the main problem is that the type provider connects to the database every time to retrieve the schema. The way to fix this is to cache the schema in a dbml file.
type dbSchema = SqlDataConnection<"connection string...",
LocalSchemaFile = "myDb.dbml",
ForceUpdate = false>
The first time, the TP will connect to the database as usual, but it will also write the schema to myDb.dbml. On subsequent compiles, it will load the schema from myDb.dbml instead of connecting to the database.
Of course, this caching means that changes to the database are not reflected in the types. So every time you need to reload the schema from the database, you can set ForceUpdate to true, do a compile (which will connect to the db), and set it back to false to use the updated myDb.dbml.
Edit: you can even commit the dbml file to your source repository if you want. This will have the additional benefit to allow collaborators who don't have access to a development version of the database to compile the solution anyway.

This answer about NGEN helped me once, but the build time of F# is still terrible compared to C#, just not minutes.

Related

Bundleconfig (seemingly) not creating requested .js files

We have a large solution with a number of files being created by bundleconfig.cs. But for some reason the last two projects added to the solution don't seem to be getting the files creating. The pages that use them fail cause they aren't there, or not being found.
Example of project successfully getting the files created:
const string ANGULAR_APP_ROOT_EDI = "~/app/ediViewer/";
const string VIRTUAL_BUNDLE_PATH_EDI = ANGULAR_APP_ROOT_EDI + "main.js";
bundles.Add(
new ScriptBundle(VIRTUAL_BUNDLE_PATH_EDI)
.Include(ANGULAR_APP_ROOT_EDI + "ediViewerApp.js")
.IncludeDirectory(ANGULAR_APP_ROOT_EDI, "*.js", searchSubdirectories: true)
);
Example of one that's not:
const string ANGULAR_APP_ROOT_EDI_SC = "~/app/SupplyChain/";
const string VIRTUAL_BUNDLE_PATH_EDI_SC = ANGULAR_APP_ROOT_EDI_SC + "main.js";
bundles.Add(
new ScriptBundle(VIRTUAL_BUNDLE_PATH_EDI_SC)
.Include(ANGULAR_APP_ROOT_EDI_SC + "SupplyChainApp.js")
.IncludeDirectory(ANGULAR_APP_ROOT_EDI_SC, "*.js", searchSubdirectories: true)
);
very similar, both Angular(js) projects with similar directory structures. but the second one gets no files. I have other projects with a similar structure that are working.
I was hoping there was a way to put breakpoints in the bundleconfig file to see if if it was hitting the code, but apparently you can't, or I didn't successfully set one up.
There are a number of bundles appearing after the new one (the standard Angular libraries) that are getting created, so it doesn't appear to be stopping in the middle or anything.
The workaround was I simply added the scripts needed manually to the aspx page, but I shouldn't have to. It's happened for two new projects so far, so I'm prepared to bet it may happen for a third, so if I can find a fix it'd be useful.
Any ideas what might be happening, or how I can troubleshoot it?

Executing a stored procedure from an external file in migrations fails in Team City build

I'm new to team city builds and running into this issue.
Created a stored procedure and tried accessing it to run in Migrations.
var sqlFile = "Scripts\StoredProc.sql";
var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
var sqlFilePath = Path.Combine(baseDirectory, #"....", sqlFile);
SqlFile(sqlFilePath);
This runs perfectly on the local environment but breaks on team city.
The path that it takes is some random BuildAgent\temp\buildTmp\
I know the way I am accessing the file with the path is wrong, anyone have any suggessions that can help me figure what virtual path I need to put here?

How does one configure VSTS specific load test context parameters for own azure agents intelligently

Recently moved from utilising AWS to Azure for the location of our load test agents, thus making the transition to making full use of VSTS.
It was described that, for the moment, to get a load test file working with VSTS to using our own VMs for testing, we need to provide two context parameters, UseStaticLoadAgents and StaticAgentsGroupName in each loadtest file.
Our load test solution is getting very large, and we have multiple loadtest files where we have to set these two values each time. This leads us into the situation where, if we were to change our agents group name for example, we would have to update each individual load test file with the new information.
Im looking at a way to centralise this until a nicer way is implemented by Microsoft. The idea was to use a load test plugin, to add these context parameters with the plugin drawing the needed values from a centralised config file.
However, it seems that none of the hooks in the load test plugin or simply using the initialise method to manually set these values is working. Likely because they are set after full initialisation.
Has anyone got a nice, code focused solution to manage this and stop us depending on adding brittle values in the editor? Or even gotten the above approach to work?
The loadtest file is the XML file, so you can update it programmatically, for example:
string filePath = #"XXX\LoadTest1.loadtest";
XmlDocument doc = new XmlDocument();
doc.Load(filePath);
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("ns", "http://microsoft.com/schemas/VisualStudio/TeamTest/2010");
XmlNode root = doc.DocumentElement;
XmlNode nodeParameters = root.SelectSingleNode("//ns:RunConfigurations/ns:RunConfiguration[#Name='Run Settings1']/ns:ContextParameters", nsmgr);
if(nodeParameters!=null)
{
//nodeParameters.SelectSingleNode("//ns:ContextParameter[#Name='UseStaticLoadAgents']").Value = "agent1";
foreach (XmlNode n in nodeParameters.ChildNodes)
{
switch (n.Attributes["Name"].Value)
{
case "Parameter1":
n.Attributes["Value"].Value = "testUpdate";
break;
case "UseStaticLoadAgents":
n.Attributes["Value"].Value = "agent1";
break;
case "StaticAgentsGroupName":
n.Attributes["Value"].Value = "group1";
break;
}
}
}
doc.Save(filePath);

Error: "include is invalid for non-ParseObjects" (using parse-osx-library-1.7.5)

I have a Meal object that stores pointers to n created objects "FoodInfo" using the key "MealItems".
When I query for the meal I take advantage of the [query includeKey:#"MealItems"] to fetch the items pointed to while fetching the "Meal".
This works swimmingly if the objects are created while online (ie. all are stored in the cloud db).
However, since I cannot assume access to the cloud at all time for this app I am now trying to enable the local datastore so I've changed my queries to use:
[query fromLocalDatastore];
and I've changed all of my objects' save methods to pinInBackgroundWithBlock followed by (assuming success of local save) saveInBackgroundWithBlock followed by (assuming failure) saveEventually.
To test this, I:
turned off wifi
ran the code to create a meal and then add newly created foods to it. This works with no error codes.
ran a report that then queries for the meal just created. This fails with the following:
Error: Error Domain=Parse Code=121
"include is invalid for non-ParseObjects" UserInfo=0x60800007f400 {
error=include is invalid for non-ParseObjects,
NSLocalizedDescription=include is invalid for non-ParseObjects,
code=121
} {
NSLocalizedDescription = "include is invalid for non-ParseObjects";
code = 121;
error = "include is invalid for non-ParseObjects";
}
Is this scenario not supported?
When I re-enable wifi, the meal is successfully added to the online db, but the query failure still happens when I run the query with the includeKey locally.
Am I missing something here? I'm quite surprised to see this failing. It seems like a really basic feature that should work whether local or cloud based.
Parse objects are not created until you save them. Try using saveEventually first before using pinInBackgroundWithBlock.

AX2012 - Pre-Processed RecId parameter not found

I made a custom report in AX2012, to replace the WHS Shipping pick list. The custom report is RDP based. I have no trouble running it directly (with the parameters dialog), but when I try to use the controller (WHSPickListShippingController), I get an error saying "Pre-Processed RecId not found. Cannot process report. Indicates a development error."
The error is because in the class SrsReportProviderQueryBuilder (setArgs method), the map variable reportProviderParameters is empty. I have no idea why that is. The code in my Data provider runs okay. Here is my code for running the report :
WHSWorkId id = 'LAM-000052';
WHSPickListShippingController controller;
Args args;
WHSShipmentTable whsShipmentTable;
WHSWorkTable whsWorkTable;
clWHSPickListShippingContract contract; //My custom RDP Contract
whsShipmentTable = WHSShipmentTable::find(whsWorkTable.ShipmentId);
args = new Args(ssrsReportStr(WHSPickListShipping, Report));
args.record(whsShipmentTable);
args.parm(whsShipmentTable.LoadId);
contract = new clWHSPickListShippingContract();
controller = new WHSPickListShippingController();
controller.parmReportName(ssrsReportStr(WHSPickListShipping, Report));
controller.parmShowDialog(false);
controller.parmLoadFromSysLastValue(false);
controller.parmReportContract().parmRdpContract(contract);
controller.parmReportContract().parmRdpName(classStr(clWHSPickListShippingDP));
controller.parmReportContract().parmRdlContract().parmLanguageId(CompanyInfo::languageId());
controller.parmArgs(args);
controller.startOperation();
I don't know if I'm clear enough... But I've been looking for a fix for hours without success, so I thought I'd ask here. Is there a reason why this variable (which comes from the method parameter AifQueryBuilderArgs) would be empty?
I'm thinking your issue is with these lines (try removing):
controller.parmReportContract().parmRdpContract(contract);
controller.parmReportContract().parmRdpName(classStr(clWHSPickListShippingDP));
controller.parmReportContract().parmRdlContract().parmLanguageId(CompanyInfo::languageId());
The style I'd expect to see with your contract would be like this:
controller = new WHSPickListShippingController();
contract = controller.getDataContractObject();
contract.parmWhatever('ParametersHere');
controller.parmArgs(args);
And for the DataProvider clWHSPickListShippingDP, usually if a report is using a DataProvider, you don't manually set it, but the DP extends SRSReportDataProviderBase and has an attribute SRSReportParameterAttribute(...) decorating the class declaration in this style:
[SRSReportParameterAttribute(classstr(MyCustomContract))]
class MyCustomDP extends SRSReportDataProviderBase
{
// Vars
}
You are using controller.parmReportContract().parmRdpContract(contract); wrong, as this is more for run-time modifications. It's typically used for accessing the contract for preRunModifyContract overloads.
Build your CrossReference in a development environment then right click on \Classes\SrsReportDataContract\parmRdpContract and click Add-Ins>Cross-reference>Used By to see how that is generally used.
Ok, so now I feel very stupid for spending so much time on that error, when it's such a tiny thing...
The erronous line is that one :
controller.parmReportName(ssrsReportStr(WHSPickListShipping, Report));
Because WHSPickListShipping is the name of the AX report, but I renamed my custom report clWHSPickListShipping. What confused me was that my DataProvider class was executing as wanted.

Resources