New VSIX project in VS2022 has XAML binding failures - visual-studio

First time create a VS extension [VSIX] project in VS2022.
I do not know what is cause of problems below. I do everything like in doc.
I tried to run a simple VSIX project hello world in VS 2022 like in doc: https://learn.microsoft.com/en-us/visualstudio/extensibility/extensibility-hello-world?view=vs-2022
Step 1.
Right-click the project (not the solution). On the context menu, select Add, and then New Item.
Step 2.
Select the Extensibility section, and then choose Command.
Step 3.
Press F5 to debug, check the XAML binding failures:
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using System;
using System.ComponentModel.Design;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
using Task = System.Threading.Tasks.Task;
namespace VSIXProject2 {
internal sealed class Command1 {
public
const int CommandId = 0x0100;
public static readonly Guid CommandSet = new Guid("f83fb9b7-23b6-4605-bc93-74df2c22ec53");
private readonly AsyncPackage package;
private Command1(AsyncPackage package, OleMenuCommandService commandService) {
this.package = package ??
throw new ArgumentNullException(nameof(package));
commandService = commandService ??
throw new ArgumentNullException(nameof(commandService));
var menuCommandID = new CommandID(CommandSet, CommandId);
var menuItem = new MenuCommand(this.Execute, menuCommandID);
commandService.AddCommand(menuItem);
}
public static Command1 Instance {
get;
private set;
}
private Microsoft.VisualStudio.Shell.IAsyncServiceProvider ServiceProvider {
get {
return this.package;
}
}
public static async Task InitializeAsync(AsyncPackage package) {
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);
OleMenuCommandService commandService = await package.GetServiceAsync(typeof (IMenuCommandService)) as OleMenuCommandService;
Instance = new Command1(package, commandService);
}
private void Execute(object sender, EventArgs e) {
ThreadHelper.ThrowIfNotOnUIThread();
string message = string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.GetType().FullName);
string title = "Command1";
VsShellUtilities.ShowMessageBox(
this.package,
message,
title,
OLEMSGICON.OLEMSGICON_INFO,
OLEMSGBUTTON.OLEMSGBUTTON_OK,
OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
}
}
}
System.Windows.Data Error: 17 : Cannot get 'CurrentState' value (type 'Int32') from '' (type 'PolicyBasedDataSource'). BindingExpression:Path=CurrentState; DataItem='PolicyBasedDataSource' (HashCode=8713795); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String') System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='' BindingExpression:Path=ToolTip; DataItem='GlyphButton' (Name='MaximizeButton'); target element is 'GlyphButton' (Name='MaximizeButton'); target property is 'Name' (type 'String') System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='' BindingExpression:Path=ToolTip; DataItem='GlyphButton' (Name='CloseButton'); target element is 'GlyphButton' (Name='CloseButton'); target property is 'Name' (type 'String') System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='' BindingExpression:Path=Content; DataItem='Button' (Name=''); target element is 'Button' (Name=''); target property is 'Name' (type 'String') System.Windows.Data Error: 40 : BindingExpression path error: 'Text' property not found on 'object' ''DataSource' (HashCode=60105532)'. BindingExpression:Path=Text; DataItem='DataSource' (HashCode=60105532); target element is 'VsToolBar' (Name=''); target property is 'Name' (type 'String') System.Windows.Data Error: 40 : BindingExpression path error: 'Items' property not found on 'object' ''DataSource' (HashCode=60105532)'. BindingExpression:Path=Items; DataItem='DataSource' (HashCode=60105532); target element is 'VsToolBar' (Name=''); target property is 'ItemsSource' (type 'IEnumerable') System.Windows.Data Error: 40 : BindingExpression path error: 'PlacementSlot' property not found on 'object' ''DataSource' (HashCode=60105532)'. BindingExpression:Path=PlacementSlot; DataItem='DataSource' (HashCode=60105532); target element is 'VsToolBar' (Name=''); target property is 'Band' (type 'Int32') System.Windows.Data Error: 40 : BindingExpression path error: 'BandIndex' property not found on 'object' ''DataSource' (HashCode=60105532)'. BindingExpression:Path=BandIndex; DataItem='DataSource' (HashCode=60105532); target element is 'VsToolBar' (Name=''); target property is 'BandIndex' (type 'Int32') System.Windows.Data Error: 40 : BindingExpression path error: 'IsVisible' property not found on 'object' ''DataSource' (HashCode=60105532)'. BindingExpression:Path=IsVisible; DataItem='DataSource' (HashCode=60105532); target element is 'VsToolBar' (Name=''); target property is 'Visibility' (type 'Visibility')
I found similar problem here: https://developercommunity.visualstudio.com/t/new-vsix-project-in-vs2022-has-xaml-binding-failur/1580267?viewtype=solutions

Related

UNITY error CS0246: The type or namespace name `MenuItem' could not be found. Are you missing an assembly reference?

For some reason i keep getting a referencing error for:
(8,6): error CS0246: The type or namespace name `MenuItem' could not be found. Are you missing an assembly reference?
(24,26): error CS0246: The type or namespace name `SerializedObject' could not be found. Are you missing an assembly reference?
Code:
using UnityEngine;
using UnityEditor;
using System.Collections;
public class AudioSourceReplacement {
[MenuItem("FMOD Tools/Replace Audio Emitters")]
private static void ReplaceEmitters()
{
AudioSource[] audioSources = Object.FindObjectsOfType<AudioSource>();
foreach (AudioSource audioSource in audioSources)
{
if (audioSource.clip == null)
{
continue;
}
string eventName = audioSource.clip.name;
string eventPath = (audioSource.spatialBlend < 0.5f ? "event:/Ambience/2D/" : "event:/Ambience/3D/") + eventName;
FMODUnity.StudioEventEmitter emitter = audioSource.gameObject.AddComponent<FMODUnity.StudioEventEmitter>();
emitter.Event = eventPath;
var so = new SerializedObject(emitter);
so.ApplyModifiedProperties();
}
for (int i=0;i<audioSources.Length;i++)
{
GameObject.DestroyImmediate(audioSources[i]);
}
}
[MenuItem("FMOD Tools/Force All Emitters Play On Start")]
private static void EmittersPlayOnStart()
{
FMODUnity.StudioEventEmitter[] audioSources = Object.FindObjectsOfType<FMODUnity.StudioEventEmitter>();
foreach (FMODUnity.StudioEventEmitter audioSource in audioSources)
{
audioSource.PlayEvent = FMODUnity.EmitterGameEvent.ObjectStart;
}
}
}
You have to put your script inside your "Editor" folder. "Assets/Editor/AudioSourceReplacement.cs" should do the trick.
This might happen because you didn't put this script inside an 'Editor' folder. It's one of these Special Folders.

Flutter build error on iOS after adding web support

I created a flutter web app.
This app is working well but I want to export it as an iOS app to use it on my phone.
When I try to build the app, I get this error :
Launching lib/main.dart on iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: QJAXXXXXXX
Xcode build done. 56,0s
Failed to build iOS app
Error output from Xcode build:
↳
2022-04-27 16:41:52.572 xcodebuild[91214:1008948] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-19114/DTDeviceKitBase/DTDKRemoteDeviceData.m:373
Details: (null) deviceType from 00008030-001E2CC81E9A402E was NULL when -platform called.
Object: <DTDKMobileDeviceToken: 0x7f8b64b380a0>
Method: -platform
Thread: <NSThread: 0x7f8b60b20e60>{number = 2, name = (null)}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
2022-04-27 16:41:52.771 xcodebuild[91214:1008959] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-19114/DTDeviceKitBase/DTDKRemoteDeviceData.m:373
Details: (null) deviceType from 00008030-001E2CC81E9A402E was NULL when -platform called.
Object: <DTDKMobileDeviceToken: 0x7f8b64b380a0>
Method: -platform
Thread: <NSThread: 0x7f8b6427c7f0>{number = 10, name = (null)}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
2022-04-27 16:41:52.845 xcodebuild[91214:1008959] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-19114/DTDeviceKitBase/DTDKRemoteDeviceData.m:373
Details: (null) deviceType from 00008030-001E2CC81E9A402E was NULL when -platform called.
Object: <DTDKMobileDeviceToken: 0x7f8b64b380a0>
Method: -platform
Thread: <NSThread: 0x7f8b6427c7f0>{number = 10, name = (null)}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/2z/tz90cc4d63gd7v38j8zm21g80000gn/T/flutter_tools.iZwJm9/flutter_ios_build_temp_dirfoYRV2/temporary_xcresult_bundle
Invalid depfile: /Users/Pierre/AndroidStudioProjects/picomanager/.dart_tool/flutter_build/05d710429877ee87af274badd140677f/kernel_snapshot.d
Invalid depfile: /Users/Pierre/AndroidStudioProjects/picomanager/.dart_tool/flutter_build/05d710429877ee87af274badd140677f/kernel_snapshot.d
Invalid depfile: /Users/Pierre/AndroidStudioProjects/picomanager/.dart_tool/flutter_build/05d710429877ee87af274badd140677f/kernel_snapshot.d
Invalid depfile: /Users/Pierre/AndroidStudioProjects/picomanager/.dart_tool/flutter_build/05d710429877ee87af274badd140677f/kernel_snapshot.d
: Error: Not found: 'dart:html'
import 'dart:html';
^
: Error: Not found: 'dart:html'
import 'dart:html';
^
: Error: Not found: 'dart:html'
import 'dart:html';
^
: Error: Not found: 'dart:html'
import 'dart:html';
^
: Error: Not found: 'dart:js'
export 'dart:js' show allowInterop, allowInteropCaptureThis;
^
: Error: Not found: 'dart:js_util'
export 'dart:js_util';
^
: Error: Not found: 'dart:html'
import 'dart:html';
^
: Error: Type 'Blob' not found.
Blob _createBlobFromBytes(Uint8List bytes, String? mimeType) {
^^^^
: Error: Type 'Blob' not found.
Blob? _browserBlob;
^^^^
: Error: Type 'Element' not found.
late Element _target;
^^^^^^^
: Error: Type 'Blob' not found.
Future<Blob> get _blob async {
^^^^
: Error: Type 'Blob' not found.
Future<Uint8List> _blobToByteBuffer(Blob blob) async {
^^^^
: Error: Type 'Element' not found.
Element Function(String href, String suggestedName) createAnchorElement;
^^^^^^^
: Error: Type 'AnchorElement' not found.
AnchorElement createAnchorElement(String href, String? suggestedName) {
^^^^^^^^^^^^^
: Error: Type 'Element' not found.
void addElementToContainerAndClick(Element container, Element element) {
^^^^^^^
: Error: Type 'Element' not found.
void addElementToContainerAndClick(Element container, Element element) {
^^^^^^^
: Error: Type 'Element' not found.
Element ensureInitialized(String id) {
^^^^^^^
: Error: 'HttpRequest' isn't a type.
final _xhrs = <HttpRequest>{};
^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final nextWrapper = allowInterop((firebase_interop.UserJsImpl? user) {
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final errorWrapper = allowInterop((e) => changeController.addError(e));
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
allowInterop((firebase_interop.UserJsImpl? user) {
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
allowInterop(idTokenChangedController.addError),
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'DatabaseReference<T>'.
- 'DatabaseReference' is from 'package:firebase/src/database.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
allowInterop((update) => jsify(transactionUpdate(dartify(update))));
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'DatabaseReference<T>'.
- 'DatabaseReference' is from 'package:firebase/src/database.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final onCompleteWrap = allowInterop(
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
- 'Query' is from 'package:firebase/src/database.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final callbackWrap = allowInterop((
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
- 'Query' is from 'package:firebase/src/database.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
jsObject.once(eventType, allowInterop(
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'DataSnapshot'.
- 'DataSnapshot' is from 'package:firebase/src/database.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final actionWrap = allowInterop((d) => action(DataSnapshot.getInstance(d)));
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
- 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final nextWrapper = allowInterop((payload) {
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
- 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final errorWrapper = allowInterop(controller.addError);
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
- 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final nextWrapper = allowInterop((payload) {
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
- 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final nextWrapper = allowInterop((_) => null);
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
- 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final errorWrapper = allowInterop((e) {
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
- 'UploadTask' is from 'package:firebase/src/storage.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/storage.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final nextWrapper = allowInterop(
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
- 'UploadTask' is from 'package:firebase/src/storage.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/storage.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final onCompletion = allowInterop(() {
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
- 'UploadTask' is from 'package:firebase/src/storage.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/storage.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
allowInterop(_changeController.addError),
^^^^^^^^^^^^
: Error: Method not found: 'hasProperty'.
if (js.hasProperty(error, 'message')) {
^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
final message = js.getProperty(error, 'message');
^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
map[key] = dartify(util.getProperty(jsObject, key));
^^^^^^^^^^^
: Error: Method not found: 'newObject'.
final jsMap = util.newObject();
^^^^^^^^^
: Error: Method not found: 'setProperty'.
util.setProperty(jsMap, key, jsify(value));
^^^^^^^^^^^
: Error: Method not found: 'allowInterop'.
return allowInterop(dartObject);
^^^^^^^^^^^^
: Error: Method not found: 'callMethod'.
util.callMethod(jsObject, method, args);
^^^^^^^^^^
: Error: Method not found: 'promiseToFuture'.
value = await util.promiseToFuture(thenable);
^^^^^^^^^^^^^^^
: Error: Method not found: 'hasProperty'.
if (util.hasProperty(e, 'code')) {
^^^^^^^^^^^
: Error: Method not found: 'allowInterop'.
PromiseJsImpl<S>(allowInterop((
^^^^^^^^^^^^
: Error: Method not found: 'allowInterop'.
allowInterop(c.completeError);
^^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
String get code => util.getProperty(_source, 'code');
^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
String get message => util.getProperty(_source, 'message');
^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
String get name => util.getProperty(_source, 'name');
^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
Object get serverResponse => util.getProperty(_source, 'serverResponse');
^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
String get stack => util.getProperty(_source, 'stack');
^^^^^^^^^^^
: Error: Method not found: 'instanceof'.
return util.instanceof(object, type);
^^^^^^^^^^
: Error: Undefined name 'window'.
Object? start = window;
^^^^^^
: Error: Method not found: 'getProperty'.
start = util.getProperty(start, item);
^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Firestore'.
- 'Firestore' is from 'package:firebase/src/firestore.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final updateFunctionWrap = allowInterop((transaction) =>
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'DocumentReference'.
- 'DocumentReference' is from 'package:firebase/src/firestore.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
allowInterop((firestore_interop.DocumentSnapshotJsImpl snapshot) {
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'DocumentReference'.
- 'DocumentReference' is from 'package:firebase/src/firestore.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final errorWrapper = allowInterop((e) => controller.addError(e));
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
- 'Query' is from 'package:firebase/src/firestore.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
allowInterop((firestore_interop.QuerySnapshotJsImpl snapshot) {
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
- 'Query' is from 'package:firebase/src/firestore.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final errorWrapper = allowInterop((e) => controller.addError(e));
^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'QuerySnapshot'.
- 'QuerySnapshot' is from 'package:firebase/src/firestore.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
allowInterop((s) => callback(DocumentSnapshot.getInstance(s)));
^^^^^^^^^^^^
: Error: The getter 'Url' isn't defined for the class 'XFile'.
- 'XFile' is from 'package:cross_file/src/types/html.dart' ('../../.pub-cache/hosted/pub.dartlang.org/cross_file-0.3.2/lib/src/types/html.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Url'.
_path = Url.createObjectUrl(_browserBlob);
^^^
: Error: The method 'Blob' isn't defined for the class 'XFile'.
- 'XFile' is from 'package:cross_file/src/types/html.dart' ('../../.pub-cache/hosted/pub.dartlang.org/cross_file-0.3.2/lib/src/types/html.dart').
Try correcting the name to the name of an existing method, or defining a method named 'Blob'.
? Blob(<dynamic>[bytes])
^^^^
: Error: The method 'Blob' isn't defined for the class 'XFile'.
- 'XFile' is from 'package:cross_file/src/types/html.dart' ('../../.pub-cache/hosted/pub.dartlang.org/cross_file-0.3.2/lib/src/types/html.dart').
Try correcting the name to the name of an existing method, or defining a method named 'Blob'.
: Blob(<dynamic>[bytes], mimeType);
^^^^
: Error: 'Blob' isn't a type.
Blob? _browserBlob;
^^^^
: Error: 'Element' isn't a type.
late Element _target;
^^^^^^^
: Error: 'HttpRequest' isn't a type.
late HttpRequest request;
^^^^^^^^^^^
: Error: 'ProgressEvent' isn't a type.
} on ProgressEvent catch (e) {
^^^^^^^^^^^^^
: Error: The getter 'HttpRequest' isn't defined for the class 'XFile'.
- 'XFile' is from 'package:cross_file/src/types/html.dart' ('../../.pub-cache/hosted/pub.dartlang.org/cross_file-0.3.2/lib/src/types/html.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'HttpRequest'.
request = await HttpRequest.request(path, responseType: 'blob');
^^^^^^^^^^^
: Error: 'Blob' isn't a type.
final Blob blob = await _blob;
^^^^
: Error: 'Blob' isn't a type.
final Blob slice = blob.slice(start ?? 0, end ?? blob.size, blob.type);
^^^^
: Error: 'Blob' isn't a type.
Future<Uint8List> _blobToByteBuffer(Blob blob) async {
^^^^
: Error: 'FileReader' isn't a type.
final FileReader reader = FileReader();
^^^^^^^^^^
: Error: The method 'FileReader' isn't defined for the class 'XFile'.
- 'XFile' is from 'package:cross_file/src/types/html.dart' ('../../.pub-cache/hosted/pub.dartlang.org/cross_file-0.3.2/lib/src/types/html.dart').
Try correcting the name to the name of an existing method, or defining a method named 'FileReader'.
final FileReader reader = FileReader();
^^^^^^^^^^
: Error: 'AnchorElement' isn't a type.
final AnchorElement element = _hasTestOverrides
^^^^^^^^^^^^^
: Error: 'AnchorElement' isn't a type.
? _overrides!.createAnchorElement(this.path, name) as AnchorElement
^^^^^^^^^^^^^
: Error: 'Element' isn't a type.
Element Function(String href, String suggestedName) createAnchorElement;
^^^^^^^
: Error: Method not found: 'webOnlyInstantiateImageCodecFromUrl'.
return ui.webOnlyInstantiateImageCodecFromUrl(// ignore: undefined_function, avoid_dynamic_calls
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: Error: The method 'HttpRequest' isn't defined for the class 'BrowserClient'.
- 'BrowserClient' is from 'package:http/src/browser_client.dart' ('../../.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/browser_client.dart').
Try correcting the name to the name of an existing method, or defining a method named 'HttpRequest'.
var xhr = HttpRequest();
^^^^^^^^^^^
: Error: 'AnchorElement' isn't a type.
final AnchorElement element = AnchorElement(href: href);
^^^^^^^^^^^^^
: Error: Method not found: 'AnchorElement'.
final AnchorElement element = AnchorElement(href: href);
^^^^^^^^^^^^^
: Error: 'Element' isn't a type.
void addElementToContainerAndClick(Element container, Element element) {
^^^^^^^
: Error: 'Element' isn't a type.
void addElementToContainerAndClick(Element container, Element element) {
^^^^^^^
: Error: 'Element' isn't a type.
Element? target = querySelector('#$id');
^^^^^^^
: Error: Method not found: 'querySelector'.
Element? target = querySelector('#$id');
^^^^^^^^^^^^^
: Error: 'Element' isn't a type.
final Element targetElement = Element.tag('flt-x-file')..id = id;
^^^^^^^
: Error: Undefined name 'Element'.
final Element targetElement = Element.tag('flt-x-file')..id = id;
^^^^^^^
: Error: Method not found: 'querySelector'.
querySelector('body')!.children.add(targetElement);
^^^^^^^^^^^^^
: Error: Undefined name 'window'.
return window.navigator.vendor == 'Apple Computer, Inc.';
^^^^^^
Unhandled exception:
FileSystemException(uri=org-dartlang-untranslatable-uri:dart%3Ahtml; message=StandardFileSystem only supports file:* and data:* URIs)
#0 StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:34:7)
#1 asFileUri (package:vm/kernel_front_end.dart:623:37)
#2 writeDepfile (package:vm/kernel_front_end.dart:763:21)
<asynchronous suspension>
#3 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:586:9)
<asynchronous suspension>
#4 starter (package:flutter_frontend_server/server.dart:85:12)
<asynchronous suspension>
#5 main (file:///opt/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:13:24)
<asynchronous suspension>
Failed to package /Users/Pierre/AndroidStudioProjects/picomanager.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in parallel
/Users/Pierre/AndroidStudioProjects/picomanager/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'leveldb-library' from project 'Pods')
Result bundle written to path:
/var/folders/2z/tz90cc4d63gd7v38j8zm21g80000gn/T/flutter_tools.iZwJm9/flutter_ios_build_temp_dirfoYRV2/temporary_xcresult_bundle
Could not build the precompiled application for the device.
Error launching application on iPhone.
Exited (sigterm)
Have you ever seen this error before ?
How did you fix it ? I tried to clean the project several times but this is not working.
Is it possible to build a flutter app designed for web on iOS ?
Thank you !
Unfortunately, Flutter builds for mobile platforms break if you have an import of dart:html somewhere in your code.
A solution to this problem can be to use conditional imports, but you have to construct something like this:
downloader.dart
void downloadFile(List<int> data, String fileName) {
throw UnimplementedError('Cannot use the downloader');
}
downloader_mobile.dart
import 'dart:developer';
void downloadFile(List<int> data, String fileName) {
log('Download is not available for mobile.');
}
downloader_web.dart
// ignore_for_file: avoid_web_libraries_in_flutter
import 'dart:convert';
import 'dart:html' as html;
void downloadFile(List<int> data, String fileName) {
final base64encodedData = base64Encode(data);
final anchor = html.AnchorElement(
href: 'data:application/octet-stream;charset=utf-8;'
'base64,$base64encodedData',
)
..setAttribute('download', fileName)
..click();
html.document.body?.children.remove(anchor);
}
And in the consuming class we check for the existence of dart.library.io and dart.library.js to determine if we are in a web or mobile environment.
import 'package:xxx/features/xxx/tools/downloader.dart'
if (dart.library.io) 'package:xxx/features/xxx/tools/downloader_mobile.dart'
if (dart.library.js) 'package:xxx/features/xxx/tools/downloader_web.dart';

ts Property Push Doesn't Exist on the type '{}' in Angular code VS

I created an array
messages: string[] =[];
After that I try to push a string value
add(message: string){
this.messages.push(message);
}
in visual studio I have the error:
[ts] Property 'push' does not exist on type '{}'.
You can try this messages: string[] = new Array<string>();
Try this one I used in my project its works
public roles = new Array<any>();
And push your Enum Object into Array
for (let item in Role)
{
if (item)
{
let temp=item;
this.roles.push(temp);
}
}
Need to check do console.log(this.roles);

Unable to cast object of type CRM 2013 Plugin

I have a Synchronous plugin that runs when any opportunity create/delete/update. And in Plugin if any error comes i have made a function which insert log into database.
In table one field if EntityId, so i am writing the following code :
foreach (PropertyBagEntry entry in (IEnumerable<PropertyBagEntry>)context.InputParameters.Values)
{
DynamicEntity entity = (DynamicEntity)entry.Value;
foreach (Property property in (IEnumerable<Property>)entity.Properties)
{
if (property.GetType().Name == "KeyProperty")
{
str4 = ((Key)entity.Properties[property.Name]).Value.ToString();
break;
}
}
}
In str4 i am getting EntityId of current process.
But it gives one exception very frequently :
Unhandled Exception: System.InvalidCastException: Unable to cast object of type
'ValueCollection[System.String,System.Object]'
to type 'System.Collections.Generic.IEnumerable`1[Microsoft.Crm.Sdk.PropertyBagEntry]'
And i have identified that the following line is giving error
foreach (PropertyBagEntry entry in (IEnumerable)context.InputParameters.Values)
Anyone have idea to convert this line in another way ?
My understanding is that you want to get the GUID of current record, if this is the case then you can do it as:
public void Execute(IServiceProvider serviceProvider)
{
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
try
{
if (context.MessageName == "Create" || context.MessageName == "Update")
{
if (context.InputParameters.Contains("Target") && (context.InputParameters["Target"] is Entity))
{
Entity currentEntity = (Entity) context.InputParameters["Target"];
Guid currentRecordGuid = currentEntity.Id;
}
}
}
catch (Exception ex)
{
}
}
I believe the type of that collection varies from one message to another. If you are looking to get the Id of the record within a plugin, this helper function may come in handy:
public static Guid GetEntityIdFromContext(IPluginExecutionContext context)
{
string messageName = context.MessageName;
if (context.PrimaryEntityId != Guid.Empty)
{
return context.PrimaryEntityId;
}
else if (messageName == "Create")
{
return new Guid(context.OutputParameters["id"].ToString());
}
else
{
return context.PrimaryEntityId;
}
}
If that doesn't help, would you mind providing the message that causes the error?
If
Unhandled Exception: System.InvalidCastException: Unable to cast
object of type 'ValueCollection[System.String,System.Object]' to type
'System.Collections.Generic.IEnumerable`1[Microsoft.Crm.Sdk.PropertyBagEntry]'
is truly your error, than your issue is not with line
foreach (Property property in (IEnumerable<Property>)entity.Properties)
but with line:
foreach (PropertyBagEntry entry in (IEnumerable<PropertyBagEntry>)context.InputParameters.Values)
The type of context.InputParameters.Values is not castable to an IEnumerable

Using IQueryable Filtering on a custom collection

I am trying to use LINQ to replace the following code..
public List<LineItem> GetEULineItems(PurchaseOrder p)
{
List<LineItem> EULineItems = new List<LineItem>();
foreach (LineItem li in p.OrderForms[0].LineItems)
{
if (li[Constants.ProductSource] != null)
{
if (li[Constants.ProductSource].ToString().Trim() == "EU")
{
EULineItems.Add(li);
}
}
}
return EULineItems;
}
I tried this but am gettin an exception..
IQueryable<LineItem> EULineItems = p.OrderForms[0].LineItems.AsQueryable().Where(s => s.ProductSource == "EU");
Exception:
'System.Linq.IQueryable' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'System.Linq.IQueryable' could be found (are you missing a using directive or an assembly reference?)
Assuming you are in fact using a custom collection you are not looking for an IQueryable, you are looking for an IEnumerable, and that should work right out of the box:
IEnumerable<LineItem> EULineItems = p.OrderForms[0]
.LineItems
.Where(s => s.ProductSource == "EU");
(provided of course you have a using System.Linq in your code file).

Resources