Diagnostic.trace output for power query in Visual Studio 2019 fails to generate output - visual-studio-2019

I am working on a custom data connector for power query using Visual Studio 2019. I include the following lines;
mytab = #table({"one","two"},{{1,2},{3,4}}),
tlog = Diagnostics.Trace(TraceLevel.Information,
"Hello",
()=>mytab,
true
)
and expect to see output in the Log tab in VS when started, there is none.
I checked the project properties and have "Show Engine traces" && "Show user traces" set to true under the Log section.
Have I constructed the Diagnostics.Trace correctly? Have I missed a setting to enable logging? I don't return tlog ( in tlog ) as I am returning query output and just wanting to generate some trace information.
Thanks in advance for any help.
Cheers!

Related

Printing a Crystal Report directly to printer

I am creating a label printing function in a program that needs to create labels for the given information. I have created a label in Crystal Reports 9 but I'm having trouble printing it.
I don't want to save the label, I just want it to print directly after the system has created it.
Dim ap9 As craxdrt.Application
Dim rpt9 As craxdrt.Report
Dim dbt As craxdrt.DatabaseTable
Set ap9 = New craxdrt.Application
On Error GoTo errError2
Set iniFile = New CIniFile
On Error GoTo errError3
Set rpt9 = ap9.OpenReport(iniFile.pathReports & REPORT_LABEL_IN)
On Error GoTo errError4
For Each dbt In rpt9.Database.Tables
dbt.Location = iniFile.pathDbCosmet
If dbt.ConnectionProperties.count <= 5 Then
dbt.ConnectionProperties.Add "Database Password", iniFile.passwordCosmet
End If
Next
rpt9.RecordSelectionFormula = sFormula
rpt9.PrintOut False, CInt(txtPacksReceived.Text)
The following code allows me to select a printer
and after clicking 'Print' at that point I am shown another dialog
However, the code executes fine, there are no errors, but the print queue doesn't show any documents and the report doesn't print.
Is there some reason why I'm not able to print my labels?
I've had problems with Zebra printers in the past that all turned out to be driver related. Have you uninstalled the printer driver and reinstalled it? Otherwise try unplugging and removing the device, plugging it into a different port and trying again?
Most likely your report doesn't contain any data - some logical error in selection/suppression formulas or similar.
If you print to any other printer, does something print out? Tracing SQL (assuming your report is bound to SQL server), can you see issued query? Does it look correct?

Application insights 2.2.1 in .net core 2.0 - turn off output to debug

This is the same question as this but for the recent version of application insights 2.2.1
Since updating to the 2.2 version the debug output is filled with AI data even if it is disabled the way it used to be done.
Previously AI was enabled in startup and I could do something like this:
services.AddApplicationInsightsTelemetry(options =>
{
options.EnableDebugLogger = false;
options.InstrumentationKey = new ConnectionStringGenerator().GetAITelemetryKey();
});
The new method of adding application insights, per the new VS templates, is to add it in Program.cs like this:
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseApplicationInsights(connectionStringGenerator.GetAITelemetryKey())
.UseSerilog()
.Build();
In this case there is no construction that takes any options and if I remove the 'UseApplicationInsights' and revert to the original method it makes no difference. Either way I get the output debug window filled wit AI logs.
In fact, even if there is no method to load AI (i.e. I remove both the 'UseApplicationInsights' and 'AddApplicationInsightsTelemetry' I get the logs.
Thanks for any help.
You can opt out of telemetry (for debug, for example) by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1.
Visual Studio is lighting up Application Insights even if you have no code to enable it. You can create an environment variable, ASPNETCORE_PREVENTHOSTINGSTARTUP = True, to prevent Visual Studio from lighting up Application Insights.
How to do this?
Right click the project in VS, Select Properties.In Debug options add environment variable as shown in below screenshot.

How do you find a user's last used printer in SysLastValue

I've been trying to find where a user's last used printer is stored so that I can clear this usage data (as a few users have an issue where the remembered printer keeps defaulting to the XPS writer, despite us having KB981681 installed & the printer being available; just not defaulted on certain AX forms).
I know this data's somewhere in the Usage Data, which I can browse via AX:
Microsoft Dynamics AX > Tools > Development Tools > Application Objects > Usage Data
AOT > System Documentation > Tables > SysLastValue > (right click) > Add-Ins > Table Browser
Or through SQL:
use AXDB
go
select *
from SysLastValue
where userid in
(
select id
from userinfo
where networkalias in ('userid1','userid2')
)
and elementname like '%print%'
and iskernel = 1
However so far I've not been able to guess which setting holds the last used printer information. Since the value field is of type image (i.e. a blob) I also can't search based on value.
Any advise on how to find this setting would be helpful.
Unfortunately there really isn't one "last used printer" stored, as much as each process packs and stores the last used print settings. Here is an example of how you can pull the last used print settings after posting a picking slip from the sales form.
static void JobGetPrinterSettingsPickList(Args _args)
{
container lastValues;
SalesFormLetter_PickingList pickList = new SalesFormLetter_PickingList();
SRSPrintDestinationSettings printSettings;
lastValues = xSysLastValue::getValue(curext(), curUserId(), UtilElementType::Class, classStr(SalesFormLetter_PickingList), formStr(SalesTable));
pickList.unpack(lastValues);
printSettings = new SRSPrintDestinationSettings(pickList.printerSettingsFormletter());
info(strFmt("%1", printSettings.printerName()));
info(strFmt("%1", printSettings.printerType()));
}
Edit: Ah I see you're having a specific issue. Check the pack/unpack and version of whatever object is having the issue. That is likely where the issue is. Or if it's on several things, check if they're all extended classes and you need to look at the parent class.

Crystal Reports XI PrintToPrinter "Missing parameter values"

I'm working on an issue with a Crystal report (Crystal XI running in a VB app) where a sporadic "Missing parameter values" error is received when trying to print the report directly. Here's a summary of the issue:
User runs the report via the report menu (everything works fine)
User clicks 'Print Preview' (everything works fine)
User clicks 'Print' (supposed to send the document directly to the printer, but sometimes get missing parameter error)
Here is what I had for code to start:
crystalReportViewer.MdiParent = parent
crystalReportViewer.Show()
Dim report As ReportDocument = CType(crystalReportViewer.ReportSource, ReportDocument)
report.PrintToPrinter(1, False, 0, 0)
crystalReportViewer.Close()
crystalReportViewer.Dispose()
Based on what I've been googling, I came up with this code:
crystalReportViewer.MdiParent = parent
crystalReportViewer.Show()
Dim report As ReportDocument = CType(crystalReportViewer.ReportSource, ReportDocument)
'here are my attempts to get it to work
Dim pf As ParameterFields = report.ParameterFields
report.PrintOptions.PrinterName = "Microsoft XPS Document Writer"
report.PrintToPrinter(1, False, 0, 0)
crystalReportViewer.Close()
crystalReportViewer.Dispose()
I'm about out of ideas on how to solve this issue. Has anyone else run across this?
Start Code: You problably have some empty parameter in your report.
After Search Code: You have this line:
Dim pf As ParameterFields = report.ParameterFields
You have a parameter, and you are not setting any value.
For both, use:
//[C#]
report.setParameterValue(parameterName, parameterValue);
It's very simple. Make sure that all of your parameters inside the report are filled and thrown data before using "printtoprinter". I have solved it with that.
As far as I can tell, this looks like an issue in Crystal. I couldn't find a fix, so I'm just using a workaround until a fix is available (report is generated and then printed manually).
First you need to add PrintDialog from toolBox
then add the following code button_click_event
ReportName.PrintOptions.PrinterName = PrintDialog1.PrinterSettings.PrinterName
ReportName.PrintOptions.PaperOrientation = CrystalDecisions.[Shared].PaperOrientation.Landscape
ReportName.PrintOptions.PrinterName = "Microsoft XPS Document Writer"
ReportName.PrintToPrinter(PrintDialog1.PrinterSettings.Copies, True, 1, 99)
This would send printing directly to "Microsoft XPS Document Writer". vote if you found this helpful

Subscribing to file check ins with tfs 2010 alerts

I am trying to setup alerts to the team when a specific file is checked into TFS, have have found some info on this using tfs 2008, which leads me to believe the following filter should work:
'Artifacts/Artifact[starts-with(#ServerItem, $/Matrix/Dev/Matrix/Applications/Matrix.UI/Web.Config)]' <> NULL
But this just give me an Invalid Token error, any ideas how i get this working in 2010?
Thanks.
With installed Power Tools, right-click in Team Explorer on the upmost node (the icon for the TeamCollection) & open "Alerts Explorer".Generate a new CheckIn alert:
now set the source control pathto the files you 're interested in:
This generated a Filter Expression = 'Artifacts/Artifact[starts-with(translate(#ServerItem, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"), "$/foo/bar.cs")]' <> null

Resources