I'm trying to do my first custom action with a LINQ query with the below code.
However I'm getting an exception. I've stepped through the debugger and
what's wierd is that when var actions get assigned and proccessed it thinks
there is 6 selectColumns instead of 3. It then goes to build a query string
duplicating the columns like this:
"SELECT `Property`, `Expression`, `Condition`, `Property`, `Expression`,
`Condition` FROM `Math`"
I'm not sure if this is an SDK bug or if I'm consuming it incorrectly. If I
take out the lines that say Property, Expression, Condition I see 3
selectColumns but I still get the exception.
Exception thrown by custom action:
System.Reflection.TargetInvocationException: Exception has been thrown by the
target of an invocation. ---> System.NullReferenceException: Object reference
not set to an instance of an object.
at Microsoft.Deployment.WindowsInstaller.Linq.Query`1.GetResult(Record
resultRec)
at
Microsoft.Deployment.WindowsInstaller.Linq.Query`1.<InvokeQuery>d__0.MoveNext()
at MGAM.Installer.CustomActions.LinqTest.ProcessMath(Session session)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object
arguments, SignatureStruct& sig, MethodAttributes methodAttributes,
RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object
arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle
typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean
skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object parameters, CultureInfo culture)
at
Microsoft.Deployment.WindowsInstaller.CustomActionProxy.InvokeCustomAction(Int32
sessionHandle, String entryPoint, Int64 remotingDelegatePtr)
[CustomAction]
public static ActionResult ProcessMath( Session session )
{
QDatabase db = session.Database.AsQueryable();
var actions = from a in db["Math"]
select new
{
Property = a["Property"],
Expression = a["Expression"],
Condition = a["Condition"]
};
foreach (var a in actions)
{
Console.WriteLine("test");
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users