method in Report Builder custom assembly not found - reporting-services

I'm trying to use a custom assembly in Report Builder 2.0. I have added the assembly to the report via Report Properties > References. When I try to call a public static method in the assembly, I get this message:
'ExtractTag' is not a member of 'ReportsClassLibrary.ReportsClassLibraryTools'.
The expression I'm trying to use to call the method is:
=ReportsClassLibrary.ReportsClassLibraryTools.ExtractTag("ID", "ID:incorrect", false)
And the method signature in the assembly is:
public static string ExtractTag(string tagToFind, string tags, bool caseSensitive)
That method is within the ReportsClassLibrary namespace and in the ReportsClassLibraryTools class.
I don't know if for some reason my report is looking an older version of the assembly that did not have this method, or if the problem is something else. I've tried removing the assembly from the report, rebuilding the assembly, and re-adding it to the report.
Edit: looks like a deeper problem. My assembly compiles, but when running a test case that calls that method, the test fails with a System.MissingMethodException. Guess I'm having an assembly problem, not a Report Builder problem...

Turned out it was a problem with the Global Assembly Cache in Vista. The old version of my assembly was cached, so the new method ExtractTag wasn't part of the assembly. I had to run:
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe" /i bin\Debug\ReportsClassLibrary.dll

Related

JsonConvert Exists in both Newtonsoft and System.Net.Http.Formatting Visual Studio 2017 for Mac

I have a project I have been working on using Xamarin's MonoDevelop.
I have been using Newtonsoft's Json nuget package.
I just downloaded Visual Studio 2017 for Mac.
I try to build my project in VS2017Mac and get the following error:
error CS0433: The type 'JsonConvert' exists in both 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' and 'System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
I thought I should be able to fix that by just adding Newtonsoft.Json. to the front of JsonConvert, but that didn't work.
I don't want to remove Newtonsoft's implementation if possible because I think their library still has more functionality. Is there another way to resolve this? Why didn't adding the full assembly reference work?
In the Properties window for the project's Newtonsoft.Json reference, change the value of Aliases from global to global, foo.
Insert extern alias foo; as the first line of any class that consumes Newtonsoft.Json.
Qualify members with foo.. Example: foo.Newtonsoft.Json.JsonConvert.SerializeObject(someObject)}.
I had the following error message but with another library(Ranet) in C#:
Error CS0433 The type 'JsonConvert' exists in both
'Microsoft.AnalysisServices.Tabular.Json, Version=14.0.0.0,
Culture=neutral, PublicKeyToken=89845dcd8080cc91' and
'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral,
PublicKeyToken=30ad4fe6b2a6aeed'
I solved it using aliases, but I would like to provide a bit more detail as I struggled to implement using the instructions from these answers and other answers. This is how I did it:
In the solution explorer, right click on the "Newtonsoft.json", add ", Newton" to the alias field, it should look something like this:
Add the following code to the first line of you file(before all using statements):
extern alias Newton;
Add the following reference to the end of your using statements:
using NewtonReference = Newton::Newtonsoft.Json;
Now you can call Newtonsoft method using the following code:
NewtonReference.JsonConvert.DeserializeObject<string>("");
A final example would look something like this:
extern alias Newton;
using System;
using NewtonReference = Newton::Newtonsoft.Json;
public class Test {
public static List<string> TestMethod() {
NewtonReference.JsonConvert.DeserializeObject<string>("");
}
}
Hopefully this will be helpful to someone else :)
If anyone is still looking for a solution, I went to the project references and it showed two different versions of Newtonsoft (versions 12.0.0 and 6.0.0 for me). I clicked on the older version and it showed me the file path to where it was stored. I simply went there and deleted it. Once that was done I had the same problem with version 9.0.0 and did the same thing. When I opened it up again the problem was fixed.
install previous ver of newtonsoft.json package.

Using Delphi component under C++ Builder makes calls to a wrong function

I'm trying to use Graphics32 package. Graphics32 was compiled and installed without any issue.
When I try to execute (debug) following code under C++ Builder XE3
TBitmap32* bmp = new TBitmap32();
bmp->LoadFromFile("d:\\sample.bmp");//This calls SaveToStream instead of LoadFromFile
...
it calls another member function SaveToStream which I can trace into and step while debugging until AV rises.
I have never encountered such behavior before.
Is there any compiler directive I'm missing or some workaround to make proper function call?
Update: I use the Graphics32 source from SVN. Everything works good if I use code prior to revision 2122.

ILMerge Error Windows Phone 8 Unresolved assembly reference

I am trying to merge some .net assemblies for Windows Phone 8 using ILMerge.exe (2.12.0803). On their own all assemblies work fine. I can successfully merge assembles which do not contain references to the Windows.Networking namespace as follows:
.\ILMerge.exe /lib:"%ProgramFiles(x86)%\Reference
Assemblies\Microsoft\Framework\WindowsPhone\v8.0"
/out:.\WP8\%1\MathToolbox.dll .\%1\MathBase.dll .\%1\PolyFunctions.dll
As soon as I try to include a DLL which uses the Windows.Networking namspace as follows:
.\ILMerge.exe /lib:"%ProgramFiles(x86)%\Reference
Assemblies\Microsoft\Framework\WindowsPhone\v8.0"
/out:.\WP8\%1\MathToolbox.dll .\%1\MathBase.dll .\%1\PolyFunctions.dll
.\%1\RemoteTools.dll
I am recieving the following exception:
An exception occurred during merging: Unresolved assembly reference
not allowed: Windows. at
System.Compiler.Ir2md.GetAssemblyRefIndex(AssemblyNode assembly) at
System.Compiler.Ir2md.GetTypeRefIndex(TypeNode type) at
System.Compiler.Ir2md.VisitReferencedType(TypeNode type) at
System.Compiler.Ir2md.VisitClass(Class Class) at
System.Compiler.Ir2md.VisitModule(Module module) at
System.Compiler.Ir2md.SetupMetadataWriter(String debugSymbolsLocation)
at System.Compiler.Ir2md.WritePE(Module module, String
debugSymbolsLocation, BinaryWriter writer) at
System.Compiler.Writer.WritePE(String location, Boolean
writeDebugSymbols, Module module, Boolean delayS ign, String
keyFileName, String keyName) at
System.Compiler.Writer.WritePE(CompilerParameters compilerParameters,
Module module) at ILMerging.ILMerge.Merge() at
ILMerging.ILMerge.Main(String[] args)
Having done some reading this exception suggets ILMerge is unable to locate the Windows.Networking assemblies. I have attempted adding various different flags to ILMERGE including:
.\ILMerge.exe /lib:"%ProgramFiles(x86)%\Reference
Assemblies\Microsoft\Framework\WindowsPhone\v8.0" /targetplatform:v4,"%ProgramFiles(x86)%\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone71"
/out:.\WP8\%1\MathToolbox.dll .\%1\MathBase.dll .\%1\PolyFunctions.dll
.\%1\RemoteTools.dll
But still get the same exception. If anyone has any suggestions that would be greatly appreciated.
I don't think ILMerge actually works with other than pure .NET assemblies, especially when Windows Phone 8 and WinRT projects uses referenced native libraries - that might be that not found "Windows" unresolved assembly.
The error indicates that ILMerge cannot find the platform's Windows.winmd. When compiling a Windows Phone or Windows Store project, you compile against two main things; The Platform SDK (WinRT) and a .NET SDK. Any tools that run over these assemblies will need both.
In addition to passing the .NET assembly folder, try passing "C:\Program Files (x86)\Windows Phone Kits\8.0\Windows Metadata directory" as a lib argument.
Make note, ILMerge is based on an older version of CCI (http://ccimetadata.codeplex.com/) so even after doing above, may still have trouble consuming the WinRT metadata format which is slightly different to .NET's.

WP8: can't consume a native component

Windows Phone 8 C# project (MyApp), migrated from WP7.1. I've added a native Windows Runtime component library (AppLib) to the solution, created a reference. There's a public sealed ref class (MyClass) in it. There's a reference to it in the C# code (in OnLoaded of the main XAML page). The whole thing compiles - meaning the metadata of the component is being generated.
When I'm trying to run, the project fails with the exception or type TypeLoadException with the following message:
Typename or Namespace was not found in metadata file. (Exception from HRESULT: 0x8000000F)
Both AppLib.DLL and AppLib.winmd can be found in the XAP. The winmd contains the information about the type, and in the right namespace, too. What else should I check?
At exception time, the AppLib.dll is not listed in the modules window of the debugger. It's as if the DLL loading fails for some reason.
I've tried with brand new class in an arbitrary namespace - same problem. Looks like the problem is on the DLL level, not on class level.
The name of the WinMD file must be a prefix of the name of the namespace in which any public and activatable types are declared. For example, if your WinMD is named AppLib.winmd, your MyClass type must be defined in namespace AppLib or some other namespace nested within that namespace, for example AppLib::Something.
It must also be declared in the "best matching" WinMD, so if your type is named A.B.MyClass and you have both A.winmd and A.B.winmd in your package, the type must be defined in A.B.winmd.
The Windows Runtime uses the name of the type to determine which WinMD file defines the type. See also my answer to "XAML cannot find reference in local namespace."

Reporting Services custom assembly: accessing report parameters

I'm writting a custom assembly to be referenced in a report. I'd like to be able to access the Report object from that assembly, so that I could then access the report parameters and other stuff that I can access in custom RDL code by using Report.stuff.
I obviously need to reference some reporting services assembly to do this, yet I can't figure out which. I tried Microsoft.ReportingServices.ProcessingCore, since it has a class Report with various properties like Parameters etc., but when I tried to pass the Report object from the RDL custom code section to my class, I got this error:
Unable to cast object of type 'ReportExprHostImpl' to type 'Microsoft.ReportingServices.ReportRendering.Report'.
There's also an assembly which exposes various interfaces and an abstract class Report, but it doesn't seem to have the parameters as a property.
So the question is, how could I achieve this, what assembly do I have to reference ? And if possible, can I access the Report object without passing it from the RDL, i.e. so that I could just register an instance of my class and later write expressions like:
=Utils.DoStuffWhileReferencingReportParameters(Fields!field.Value)
Reference these two dlls in your library:
Microsoft.ReportingServices.ProcessingCore
Microsoft.ReportingServices.ProcessingObjectModel
Put the following code in your library (as an example)
using Microsoft.ReportingServices.ReportProcessing.ReportObjectModel;
public static string Test(Parameters item)
{
return item ["my_parameter_name"].Value.ToString();
}
Here’s an example expression to use in your RDL file:
=MyNameSpace.MyStaticClass.Test(Parameters)