Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista Tutorial - XamlParseException -> System.Security exception

 
 
Old 07-29-2008   #1 (permalink)
Thomas W. Brown
Guest


 
 

XamlParseException -> System.Security exception

I must be missing something obvious... I just installed VS 2008 on a new
laptop (running XP SP3) and am trying the most simple WPF application
(dropping a button onto the default grid. When I try to run I get an
XamlParseException error (Line 1, position 9) but the inner, inner exception
is a security exception:

{"Request for the permission of type
'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}

The stack trace is coming up through
System.Windows.Markup.BamlRecordReader.CreateInstanceFromType

Is there some .NET Security configuration I've missed? The weird thing is
that on another machine I have no such problems and the .NET security
configuration on both appears to be the same.

TIA
-- TB


My System SpecsSystem Spec
Old 07-29-2008   #2 (permalink)
xYrus
Guest


 
 

Re: XamlParseException -> System.Security exception

Could you try to upgrade to .NET 3.5
(http://www.microsoft.com/downloads/d...displaylang=en)
and try again?

Ususally, you don't have to configure security parameters. But note that,
when you do some local system action (e.g. deleting a file) in browser
applications, you will get a security error.

You can also get extended information about XAML parsing errory by executing
the project via "F11" key (debug per line) and press F11 until the exception
arrives. The highlighted line causes the error.

If nothing helps, you could send me the sample code (e-mail in header) and I
will check that in a new XPSP3 virtual machine.

"Thomas W. Brown" <thomas_w_brown@xxxxxx> schrieb im
Newsbeitrag news:3600C6A9-D357-4C83-9912-3381937D6740@xxxxxx
Quote:

>I must be missing something obvious... I just installed VS 2008 on a new
> laptop (running XP SP3) and am trying the most simple WPF application
> (dropping a button onto the default grid. When I try to run I get an
> XamlParseException error (Line 1, position 9) but the inner, inner
> exception
> is a security exception:
>
> {"Request for the permission of type
> 'System.Security.Permissions.SecurityPermission, mscorlib,
> Version=2.0.0.0,
> Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}
>
> The stack trace is coming up through
> System.Windows.Markup.BamlRecordReader.CreateInstanceFromType
>
> Is there some .NET Security configuration I've missed? The weird thing is
> that on another machine I have no such problems and the .NET security
> configuration on both appears to be the same.
>
> TIA
> -- TB
>
My System SpecsSystem Spec
Old 07-29-2008   #3 (permalink)
Thomas W. Brown
Guest


 
 

Re: XamlParseException -> System.Security exception

Already using .NET 3.5 -- I've installed VS2008. I checked anyway, and the
installer confirmed that I already have it.

The code is so simple it's not worth sending. Create a new WPF application
in VS 2008, drag a button onto the grid, press F5 to run.

On one machine, that I've had for awhile, and it has had VS 2003, VS 2005,
and now VS 2008, this works just fine. On my new laptop, with only VS 2008,
I get the error below. Both machines are running XP SP3.

-- TB

"xYrus" wrote:
Quote:

> Could you try to upgrade to .NET 3.5
> (http://www.microsoft.com/downloads/d...displaylang=en)
> and try again?
>
> Ususally, you don't have to configure security parameters. But note that,
> when you do some local system action (e.g. deleting a file) in browser
> applications, you will get a security error.
>
> You can also get extended information about XAML parsing errory by executing
> the project via "F11" key (debug per line) and press F11 until the exception
> arrives. The highlighted line causes the error.
>
> If nothing helps, you could send me the sample code (e-mail in header) and I
> will check that in a new XPSP3 virtual machine.
>
> "Thomas W. Brown" <thomas_w_brown@xxxxxx> schrieb im
> Newsbeitrag news:3600C6A9-D357-4C83-9912-3381937D6740@xxxxxx
Quote:

> >I must be missing something obvious... I just installed VS 2008 on a new
> > laptop (running XP SP3) and am trying the most simple WPF application
> > (dropping a button onto the default grid. When I try to run I get an
> > XamlParseException error (Line 1, position 9) but the inner, inner
> > exception
> > is a security exception:
> >
> > {"Request for the permission of type
> > 'System.Security.Permissions.SecurityPermission, mscorlib,
> > Version=2.0.0.0,
> > Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}
> >
> > The stack trace is coming up through
> > System.Windows.Markup.BamlRecordReader.CreateInstanceFromType
> >
> > Is there some .NET Security configuration I've missed? The weird thing is
> > that on another machine I have no such problems and the .NET security
> > configuration on both appears to be the same.
> >
> > TIA
> > -- TB
> >
>
My System SpecsSystem Spec
Old 07-29-2008   #4 (permalink)
Thomas W. Brown
Guest


 
 

Re: XamlParseException -> System.Security exception

One slight clarification... There is actually another InnerException
available, with a slightly different stack trace:

at System.Security.CodeAccessSecurityEngine.Check(Object demand,
StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at MS.Internal.PresentationFramework.SecurityHelper.DemandUnmanagedCode()
at System.Windows.Window..ctor()
at Test.Window1..ctor()

Perhaps this helps shed some light on this issue??

-- TB

"xYrus" wrote:
Quote:

> Could you try to upgrade to .NET 3.5
> (http://www.microsoft.com/downloads/d...displaylang=en)
> and try again?
>
> Ususally, you don't have to configure security parameters. But note that,
> when you do some local system action (e.g. deleting a file) in browser
> applications, you will get a security error.
>
> You can also get extended information about XAML parsing errory by executing
> the project via "F11" key (debug per line) and press F11 until the exception
> arrives. The highlighted line causes the error.
>
> If nothing helps, you could send me the sample code (e-mail in header) and I
> will check that in a new XPSP3 virtual machine.
>
> "Thomas W. Brown" <thomas_w_brown@xxxxxx> schrieb im
> Newsbeitrag news:3600C6A9-D357-4C83-9912-3381937D6740@xxxxxx
Quote:

> >I must be missing something obvious... I just installed VS 2008 on a new
> > laptop (running XP SP3) and am trying the most simple WPF application
> > (dropping a button onto the default grid. When I try to run I get an
> > XamlParseException error (Line 1, position 9) but the inner, inner
> > exception
> > is a security exception:
> >
> > {"Request for the permission of type
> > 'System.Security.Permissions.SecurityPermission, mscorlib,
> > Version=2.0.0.0,
> > Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}
> >
> > The stack trace is coming up through
> > System.Windows.Markup.BamlRecordReader.CreateInstanceFromType
> >
> > Is there some .NET Security configuration I've missed? The weird thing is
> > that on another machine I have no such problems and the .NET security
> > configuration on both appears to be the same.
> >
> > TIA
> > -- TB
> >
>
My System SpecsSystem Spec
Old 07-29-2008   #5 (permalink)
Thomas W. Brown
Guest


 
 

Re: XamlParseException -> System.Security exception

Here's the XAML, the code-behind is all default generated by VS2008; I
haven't modified a thing:

<Window x:Class="Test.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<Button Margin="98,115,105,125" Name="button1">Hello, World!</Button>
</Grid>
</Window>



"xYrus" wrote:
Quote:

> Could you try to upgrade to .NET 3.5
> (http://www.microsoft.com/downloads/d...displaylang=en)
> and try again?
>
> Ususally, you don't have to configure security parameters. But note that,
> when you do some local system action (e.g. deleting a file) in browser
> applications, you will get a security error.
>
> You can also get extended information about XAML parsing errory by executing
> the project via "F11" key (debug per line) and press F11 until the exception
> arrives. The highlighted line causes the error.
>
> If nothing helps, you could send me the sample code (e-mail in header) and I
> will check that in a new XPSP3 virtual machine.
>
> "Thomas W. Brown" <thomas_w_brown@xxxxxx> schrieb im
> Newsbeitrag news:3600C6A9-D357-4C83-9912-3381937D6740@xxxxxx
Quote:

> >I must be missing something obvious... I just installed VS 2008 on a new
> > laptop (running XP SP3) and am trying the most simple WPF application
> > (dropping a button onto the default grid. When I try to run I get an
> > XamlParseException error (Line 1, position 9) but the inner, inner
> > exception
> > is a security exception:
> >
> > {"Request for the permission of type
> > 'System.Security.Permissions.SecurityPermission, mscorlib,
> > Version=2.0.0.0,
> > Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}
> >
> > The stack trace is coming up through
> > System.Windows.Markup.BamlRecordReader.CreateInstanceFromType
> >
> > Is there some .NET Security configuration I've missed? The weird thing is
> > that on another machine I have no such problems and the .NET security
> > configuration on both appears to be the same.
> >
> > TIA
> > -- TB
> >
>
My System SpecsSystem Spec
Old 07-29-2008   #6 (permalink)
Thomas W. Brown
Guest


 
 

RE: XamlParseException -> System.Security exception

Ok, enough detective work turned up the need, on this installation at least,
to explicitly set the Security settings for this project to "Enable ClickOnce
Security Settings" where the option for full trust application was already
selected. Once I did this, I can run even the vanilla app created for a
blank WPF Application in VS2008 without encountering the error.

Still a mystery, though, is why, on my other machine, do I not need to do
this? Why is the "WPF Application" wizard code, on my new laptop
installation, trying to run in the sandbox? The project is set to build a
Windows Application.

-- TB

"Thomas W. Brown" wrote:
Quote:

> I must be missing something obvious... I just installed VS 2008 on a new
> laptop (running XP SP3) and am trying the most simple WPF application
> (dropping a button onto the default grid. When I try to run I get an
> XamlParseException error (Line 1, position 9) but the inner, inner exception
> is a security exception:
>
> {"Request for the permission of type
> 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0,
> Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}
>
> The stack trace is coming up through
> System.Windows.Markup.BamlRecordReader.CreateInstanceFromType
>
> Is there some .NET Security configuration I've missed? The weird thing is
> that on another machine I have no such problems and the .NET security
> configuration on both appears to be the same.
>
> TIA
> -- TB
>
My System SpecsSystem Spec
Old 07-29-2008   #7 (permalink)
Thomas W. Brown
Guest


 
 

RE: XamlParseException -> System.Security exception

O...M...G...,

Ok, I finally realized that this laptop was setup to redirect "My Documents"
to a mapped network drive. So, the default location for new projects was on
a network share instead of the local hard drive. I was essentially getting
the same error one gets when trying to run a .NET Forms application from a
network share, just very much disguised!!!

It will be nice to see the next round of improvements in the IDE for working
with XAML and WPF projects!!!!!!!

-- TB

"Thomas W. Brown" wrote:
Quote:

> I must be missing something obvious... I just installed VS 2008 on a new
> laptop (running XP SP3) and am trying the most simple WPF application
> (dropping a button onto the default grid. When I try to run I get an
> XamlParseException error (Line 1, position 9) but the inner, inner exception
> is a security exception:
>
> {"Request for the permission of type
> 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0,
> Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}
>
> The stack trace is coming up through
> System.Windows.Markup.BamlRecordReader.CreateInstanceFromType
>
> Is there some .NET Security configuration I've missed? The weird thing is
> that on another machine I have no such problems and the .NET security
> configuration on both appears to be the same.
>
> TIA
> -- TB
>
My System SpecsSystem Spec
Old 07-31-2008   #8 (permalink)
maxima
Guest


 
 

RE: XamlParseException -> System.Security exception

I had similar problem. Installed VS2008 and made a little test app with few
buttons. I had same exception - line 1 character 9 thingy.

I started to comment out C# code line by line and then found that some very
simple code in Windows1 constructor was the cause of the exception in
run-time.

I had to move it into OnIntitalize and it works since that. I still dont
know why it was heppening though as the code did compile fine and looked
pretty legitimate.

I just wonder - how much real PITA this 'nice' separation (XAML from
code-behind) is going to bring into development processes in big projects
within big teams. Especially if 'designers' will be in charge of XAML and
'developers' - of C# code-behind.



"Thomas W. Brown" wrote:
Quote:

> O...M...G...,
>
> Ok, I finally realized that this laptop was setup to redirect "My Documents"
> to a mapped network drive. So, the default location for new projects was on
> a network share instead of the local hard drive. I was essentially getting
> the same error one gets when trying to run a .NET Forms application from a
> network share, just very much disguised!!!
>
> It will be nice to see the next round of improvements in the IDE for working
> with XAML and WPF projects!!!!!!!
>
> -- TB
>
> "Thomas W. Brown" wrote:
>
Quote:

> > I must be missing something obvious... I just installed VS 2008 on a new
> > laptop (running XP SP3) and am trying the most simple WPF application
> > (dropping a button onto the default grid. When I try to run I get an
> > XamlParseException error (Line 1, position 9) but the inner, inner exception
> > is a security exception:
> >
> > {"Request for the permission of type
> > 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0,
> > Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}
> >
> > The stack trace is coming up through
> > System.Windows.Markup.BamlRecordReader.CreateInstanceFromType
> >
> > Is there some .NET Security configuration I've missed? The weird thing is
> > that on another machine I have no such problems and the .NET security
> > configuration on both appears to be the same.
> >
> > TIA
> > -- TB
> >
My System SpecsSystem Spec
Old 07-31-2008   #9 (permalink)
Thomas W. Brown
Guest


 
 

RE: XamlParseException -> System.Security exception

I hear ya! I think we'll see the same trend as all other "ground-breaking"
development paradigms coming out of Redmond... To my mind, MFC wasn't usable
until v2.0, .NET was only barely usable at 1.1 and didn't become first class
until 2.0, Windows itself didn't shine until Win98 (trust me on this, I was
developing apps for Windows 1.04!!)...

So, I'm not expecting any of the new stuff (LINQ, WCF and WPF) to really hit
their stride until we get at least one major version underneath our belts.
Even then, we'll have to see...

Regards,
-- TB

"maxima" wrote:
Quote:

> I had similar problem. Installed VS2008 and made a little test app with few
> buttons. I had same exception - line 1 character 9 thingy.
>
> I started to comment out C# code line by line and then found that some very
> simple code in Windows1 constructor was the cause of the exception in
> run-time.
>
> I had to move it into OnIntitalize and it works since that. I still dont
> know why it was heppening though as the code did compile fine and looked
> pretty legitimate.
>
> I just wonder - how much real PITA this 'nice' separation (XAML from
> code-behind) is going to bring into development processes in big projects
> within big teams. Especially if 'designers' will be in charge of XAML and
> 'developers' - of C# code-behind.
>
>
>
> "Thomas W. Brown" wrote:
>
Quote:

> > O...M...G...,
> >
> > Ok, I finally realized that this laptop was setup to redirect "My Documents"
> > to a mapped network drive. So, the default location for new projects was on
> > a network share instead of the local hard drive. I was essentially getting
> > the same error one gets when trying to run a .NET Forms application from a
> > network share, just very much disguised!!!
> >
> > It will be nice to see the next round of improvements in the IDE for working
> > with XAML and WPF projects!!!!!!!
> >
> > -- TB
> >
> > "Thomas W. Brown" wrote:
> >
Quote:

> > > I must be missing something obvious... I just installed VS 2008 on a new
> > > laptop (running XP SP3) and am trying the most simple WPF application
> > > (dropping a button onto the default grid. When I try to run I get an
> > > XamlParseException error (Line 1, position 9) but the inner, inner exception
> > > is a security exception:
> > >
> > > {"Request for the permission of type
> > > 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0,
> > > Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}
> > >
> > > The stack trace is coming up through
> > > System.Windows.Markup.BamlRecordReader.CreateInstanceFromType
> > >
> > > Is there some .NET Security configuration I've missed? The weird thing is
> > > that on another machine I have no such problems and the .NET security
> > > configuration on both appears to be the same.
> > >
> > > TIA
> > > -- TB
> > >
My System SpecsSystem Spec
Old 07-31-2008   #10 (permalink)
maxima
Guest


 
 

RE: XamlParseException -> System.Security exception

I started from punching cards for ibm 360 :-P

perhaps we are too old to appreciate the 'real' beauty of wpf

"Thomas W. Brown" wrote:
Quote:

> I hear ya! I think we'll see the same trend as all other "ground-breaking"
> development paradigms coming out of Redmond... To my mind, MFC wasn't usable
> until v2.0, .NET was only barely usable at 1.1 and didn't become first class
> until 2.0, Windows itself didn't shine until Win98 (trust me on this, I was
> developing apps for Windows 1.04!!)...
My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
system service exception BSOD General Discussion
Stop : 0x0000003b System Service Exception Vista installation & setup
.net security exception .NET General
System Service Exception Vista General
Error loading system MshSnapIns exception from C# dll PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46